diff options
Diffstat (limited to 'runtime')
185 files changed, 11153 insertions, 5723 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index cad8da6ffb..69498dc1a1 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -2,6 +2,8 @@ set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genvimvim.lua) set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime) set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim) set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags) +set(GENERATED_PACKAGE_DIR ${GENERATED_RUNTIME_DIR}/pack/dist/opt) +set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack) file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}) file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax) @@ -9,15 +11,57 @@ file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax/vim) add_custom_command(OUTPUT ${GENERATED_SYN_VIM} COMMAND ${LUA_PRG} ${SYN_VIM_GENERATOR} - ${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM} + ${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM} ${FUNCS_DATA} DEPENDS ${SYN_VIM_GENERATOR} ${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua ${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua ${PROJECT_SOURCE_DIR}/src/nvim/options.lua ${PROJECT_SOURCE_DIR}/src/nvim/eval.c + ${FUNCS_DATA} ) +if(POLICY CMP0054) + cmake_policy(SET CMP0054 OLD) +endif() + +file(GLOB PACKAGES ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*) + +set(GENERATED_PACKAGE_TAGS) +foreach(PACKAGE ${PACKAGES}) + get_filename_component(PACKNAME ${PACKAGE} NAME) + file(GLOB "${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt) + if("${PACKNAME}_DOC_FILES") + file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME}) + add_custom_target("${PACKNAME}-tags" + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME} + COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" + -u NONE -i NONE -e --headless -c "helptags doc" -c quit + DEPENDS + nvim + WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}" + ) + + add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags" + DEPENDS + "${PACKNAME}-tags" + ) + + set("${PACKNAME}_DOC_NAMES") + foreach(DF "${${PACKNAME}_DOC_FILES}") + get_filename_component(F ${DF} NAME) + list(APPEND "${PACKNAME}_DOC_NAMES" ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/${F}) + endforeach() + + install_helper( + FILES ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags "${${PACKNAME}_DOC_NAMES}" + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/pack/dist/opt/${PACKNAME}/doc) + + list(APPEND GENERATED_PACKAGE_TAGS "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags") + endif() +endforeach() + file(GLOB DOCFILES ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt) set(BUILDDOCFILES) @@ -26,22 +70,25 @@ foreach(DF ${DOCFILES}) list(APPEND BUILDDOCFILES ${GENERATED_RUNTIME_DIR}/doc/${F}) endforeach() -add_custom_command(OUTPUT copy_docfiles - COMMAND ${CMAKE_COMMAND} -E copy_directory +add_custom_target(helptags + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc + COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" + -u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit + DEPENDS + nvim + WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}" ) add_custom_command(OUTPUT ${GENERATED_HELP_TAGS} - COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" - -u NONE - -i NONE - -e - --headless - -c "helptags ++t ." - -c quit DEPENDS - copy_docfiles - nvim + helptags +) + +add_custom_target(doc_html + COMMAND make html + DEPENDS + ${GENERATED_HELP_TAGS} WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc" ) @@ -50,8 +97,23 @@ add_custom_target( DEPENDS ${GENERATED_SYN_VIM} ${GENERATED_HELP_TAGS} + ${GENERATED_PACKAGE_TAGS} ) +# Optional targets for nvim.desktop file and icon. +find_program(XDG_MENU_PRG xdg-desktop-menu) +find_program(XDG_ICON_PRG xdg-icon-resource) +if(XDG_MENU_PRG) + add_custom_target(desktop-file + COMMAND xdg-desktop-menu install --novendor ${PROJECT_SOURCE_DIR}/runtime/nvim.desktop) + # add_dependencies(runtime desktop-file) +endif() +if(XDG_ICON_PRG) + add_custom_target(desktop-icon + COMMAND xdg-icon-resource install --novendor --size 128 ${PROJECT_SOURCE_DIR}/runtime/nvim.png) + # add_dependencies(runtime desktop-icon) +endif() + # CMake is painful here. It will create the destination using the user's # current umask, and we don't want that. And we don't just want to install # the target directory, as it will mess with existing permissions. So this @@ -78,7 +140,7 @@ endforeach() file(GLOB_RECURSE RUNTIME_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - *.vim *.dict *.py *.ps *.tutor) + *.vim *.dict *.py *.rb *.ps *.tutor) foreach(F ${RUNTIME_FILES}) get_filename_component(BASEDIR ${F} PATH) 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/csscomplete.vim b/runtime/autoload/csscomplete.vim index 9eebb87d5b..50048a37fd 100644 --- a/runtime/autoload/csscomplete.vim +++ b/runtime/autoload/csscomplete.vim @@ -1,429 +1,740 @@ " Vim completion script -" Language: CSS 2.1 -" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2007 May 5 +" Language: CSS +" Based on MDN CSS Reference at 2016 Jan <https://developer.mozilla.org/en-US/docs/Web/CSS/Reference> +" 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 - let s:values = split("azimuth background background-attachment background-color background-image background-position background-repeat border bottom border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width caption-side clear clip color content counter-increment counter-reset cue cue-after cue-before cursor display direction elevation empty-cells float font font-family font-size font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-right margin-left margin-top margin-bottom max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding padding-top padding-right padding-bottom padding-left page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes right richness speak speak-header speak-numeral speak-punctuation speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space width widows word-spacing z-index") +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") -function! csscomplete#CompleteCSS(findstart, base) - -if a:findstart - " We need whole line to proper checking - let line = getline('.') - let start = col('.') - 1 - let compl_begin = col('.') - 2 - while start >= 0 && line[start - 1] =~ '\%(\k\|-\)' - let start -= 1 - endwhile - let b:compl_context = line[0:compl_begin] - return start -endif - -" There are few chars important for context: -" ^ ; : { } /* */ -" Where ^ is start of line and /* */ are comment borders -" Depending on their relative position to cursor we will know what should -" be completed. -" 1. if nearest are ^ or { or ; current word is property -" 2. if : it is value (with exception of pseudo things) -" 3. if } we are outside of css definitions -" 4. for comments ignoring is be the easiest but assume they are the same -" as 1. -" 5. if @ complete at-rule -" 6. if ! complete important -if exists("b:compl_context") - let line = b:compl_context - unlet! b:compl_context -else - let line = a:base -endif - -let res = [] -let res2 = [] -let borders = {} - -" Check last occurrence of sequence - -let openbrace = strridx(line, '{') -let closebrace = strridx(line, '}') -let colon = strridx(line, ':') -let semicolon = strridx(line, ';') -let opencomm = strridx(line, '/*') -let closecomm = strridx(line, '*/') -let style = strridx(line, 'style\s*=') -let atrule = strridx(line, '@') -let exclam = strridx(line, '!') - -if openbrace > -1 - let borders[openbrace] = "openbrace" -endif -if closebrace > -1 - let borders[closebrace] = "closebrace" -endif -if colon > -1 - let borders[colon] = "colon" -endif -if semicolon > -1 - let borders[semicolon] = "semicolon" -endif -if opencomm > -1 - let borders[opencomm] = "opencomm" -endif -if closecomm > -1 - let borders[closecomm] = "closecomm" -endif -if style > -1 - let borders[style] = "style" -endif -if atrule > -1 - let borders[atrule] = "atrule" -endif -if exclam > -1 - let borders[exclam] = "exclam" -endif - - -if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$' - " Complete properties - - - let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$') - - for m in s:values - if m =~? '^'.entered_property - call add(res, m . ':') - elseif m =~? entered_property - call add(res2, m . ':') - endif - endfor - - return res + res2 - -elseif borders[max(keys(borders))] == 'colon' - " Get name of property - let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$')) - - if prop == 'azimuth' - let values = ["left-side", "far-left", "left", "center-left", "center", "center-right", "right", "far-right", "right-side", "behind", "leftwards", "rightwards"] - elseif prop == 'background-attachment' - let values = ["scroll", "fixed"] - elseif prop == 'background-color' - let values = ["transparent", "rgb(", "#"] - elseif prop == 'background-image' - let values = ["url(", "none"] - elseif prop == 'background-position' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z]\+\)\?$' - let values = ["top", "center", "bottom"] - elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["left", "center", "right"] - else - return [] - endif - elseif prop == 'background-repeat' - let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"] - elseif prop == 'background' - let values = ["url(", "scroll", "fixed", "transparent", "rgb(", "#", "none", "top", "center", "bottom" , "left", "right", "repeat", "repeat-x", "repeat-y", "no-repeat"] - elseif prop == 'border-collapse' - let values = ["collapse", "separate"] - elseif prop == 'border-color' - let values = ["rgb(", "#", "transparent"] - elseif prop == 'border-spacing' - return [] - elseif prop == 'border-style' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)$' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' - let values = ["thin", "thick", "medium"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = ["rgb(", "#", "transparent"] - else - return [] - endif - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-color' - let values = ["rgb(", "#", "transparent"] - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-style' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-width' - let values = ["thin", "thick", "medium"] - elseif prop == 'border-width' - let values = ["thin", "thick", "medium"] - elseif prop == 'border' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' - let values = ["thin", "thick", "medium"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = ["rgb(", "#", "transparent"] - else - return [] - endif - elseif prop == 'bottom' - let values = ["auto"] - elseif prop == 'caption-side' - let values = ["top", "bottom"] - elseif prop == 'clear' - let values = ["none", "left", "right", "both"] - elseif prop == 'clip' - let values = ["auto", "rect("] - elseif prop == 'color' - let values = ["rgb(", "#"] - elseif prop == 'content' - let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"] - elseif prop =~ 'counter-\%(increment\|reset\)$' - let values = ["none"] - elseif prop =~ '^\%(cue-after\|cue-before\|cue\)$' - let values = ["url(", "none"] - elseif prop == 'cursor' - let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"] - elseif prop == 'direction' - let values = ["ltr", "rtl"] - elseif prop == 'display' - let values = ["inline", "block", "list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none"] - elseif prop == 'elevation' - let values = ["below", "level", "above", "higher", "lower"] - elseif prop == 'empty-cells' - let values = ["show", "hide"] - elseif prop == 'float' - let values = ["left", "right", "none"] - elseif prop == 'font-family' - let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"] - elseif prop == 'font-size' - let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"] - elseif prop == 'font-style' - let values = ["normal", "italic", "oblique"] - elseif prop == 'font-variant' - let values = ["normal", "small-caps"] - elseif prop == 'font-weight' - let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"] - elseif prop == 'font' - let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"] - elseif prop =~ '^\%(height\|width\)$' - let values = ["auto"] - elseif prop =~ '^\%(left\|rigth\)$' - let values = ["auto"] - elseif prop == 'letter-spacing' - let values = ["normal"] - elseif prop == 'line-height' - let values = ["normal"] - elseif prop == 'list-style-image' - let values = ["url(", "none"] - elseif prop == 'list-style-position' - let values = ["inside", "outside"] - elseif prop == 'list-style-type' - let values = ["disc", "circle", "square", "decimal", "decimal-leading-zero", "lower-roman", "upper-roman", "lower-latin", "upper-latin", "none"] - elseif prop == 'list-style' - return [] - elseif prop == 'margin' - let values = ["auto"] - elseif prop =~ 'margin-\%(right\|left\|top\|bottom\)$' - let values = ["auto"] - elseif prop == 'max-height' - let values = ["auto"] - elseif prop == 'max-width' - let values = ["none"] - elseif prop == 'min-height' - let values = ["none"] - elseif prop == 'min-width' - let values = ["none"] - elseif prop == 'orphans' - return [] - elseif prop == 'outline-color' - let values = ["rgb(", "#"] - elseif prop == 'outline-style' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif prop == 'outline-width' - let values = ["thin", "thick", "medium"] - elseif prop == 'outline' - let vals = matchstr(line, '.*:\s*\zs.*') - if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$' - let values = ["rgb(", "#"] - elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$' - let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] - elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' - let values = ["thin", "thick", "medium"] - else - return [] - endif - elseif prop == 'overflow' - let values = ["visible", "hidden", "scroll", "auto"] - elseif prop == 'padding' - return [] - elseif prop =~ 'padding-\%(top\|right\|bottom\|left\)$' - return [] - elseif prop =~ 'page-break-\%(after\|before\)$' - let values = ["auto", "always", "avoid", "left", "right"] - elseif prop == 'page-break-inside' - let values = ["auto", "avoid"] - elseif prop =~ 'pause-\%(after\|before\)$' - return [] - elseif prop == 'pause' - return [] - elseif prop == 'pitch-range' - return [] - elseif prop == 'pitch' - let values = ["x-low", "low", "medium", "high", "x-high"] - elseif prop == 'play-during' - let values = ["url(", "mix", "repeat", "auto", "none"] - elseif prop == 'position' - let values = ["static", "relative", "absolute", "fixed"] - elseif prop == 'quotes' - let values = ["none"] - elseif prop == 'richness' - return [] - elseif prop == 'speak-header' - let values = ["once", "always"] - elseif prop == 'speak-numeral' - let values = ["digits", "continuous"] - elseif prop == 'speak-punctuation' - let values = ["code", "none"] - elseif prop == 'speak' - let values = ["normal", "none", "spell-out"] - elseif prop == 'speech-rate' - let values = ["x-slow", "slow", "medium", "fast", "x-fast", "faster", "slower"] - elseif prop == 'stress' - return [] - elseif prop == 'table-layout' - let values = ["auto", "fixed"] - elseif prop == 'text-align' - let values = ["left", "right", "center", "justify"] - elseif prop == 'text-decoration' - let values = ["none", "underline", "overline", "line-through", "blink"] - elseif prop == 'text-indent' - return [] - elseif prop == 'text-transform' - let values = ["capitalize", "uppercase", "lowercase", "none"] - elseif prop == 'top' - let values = ["auto"] - elseif prop == 'unicode-bidi' - let values = ["normal", "embed", "bidi-override"] - elseif prop == 'vertical-align' - let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"] - elseif prop == 'visibility' - let values = ["visible", "hidden", "collapse"] - elseif prop == 'voice-family' - return [] - elseif prop == 'volume' - let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"] - elseif prop == 'white-space' - let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"] - elseif prop == 'widows' - return [] - elseif prop == 'word-spacing' - let values = ["normal"] - elseif prop == 'z-index' - let values = ["auto"] - else - " If no property match it is possible we are outside of {} and - " trying to complete pseudo-(class|element) - let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$')) - if stridx(',a,abbr,acronym,address,area,b,base,bdo,big,blockquote,body,br,button,caption,cite,code,col,colgroup,dd,del,dfn,div,dl,dt,em,fieldset,form,head,h1,h2,h3,h4,h5,h6,hr,html,i,img,input,ins,kbd,label,legend,li,link,map,meta,noscript,object,ol,optgroup,option,p,param,pre,q,samp,script,select,small,span,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,ul,var,', ','.element.',') > -1 - let values = ["first-child", "link", "visited", "hover", "active", "focus", "lang", "first-line", "first-letter", "before", "after"] - else - return [] - endif - endif - - " Complete values - let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$') - - for m in values - if m =~? '^'.entered_value - call add(res, m) - elseif m =~? entered_value - call add(res2, m) - endif - endfor - - return res + res2 - -elseif borders[max(keys(borders))] == 'closebrace' - - return [] - -elseif borders[max(keys(borders))] == 'exclam' - - " Complete values - let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$') - - let values = ["important"] - - for m in values - if m =~? '^'.entered_imp - call add(res, m) - endif - endfor - - return res - -elseif borders[max(keys(borders))] == 'atrule' - - let afterat = matchstr(line, '.*@\zs.*') - - if afterat =~ '\s' - - let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze') - - if atrulename == 'media' - let values = ["screen", "tty", "tv", "projection", "handheld", "print", "braille", "aural", "all"] - - let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$') - - elseif atrulename == 'import' - let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$') - - if entered_atruleafter =~ "^[\"']" - let filestart = matchstr(entered_atruleafter, '^.\zs.*') - let files = split(glob(filestart.'*'), '\n') - let values = map(copy(files), '"\"".v:val') - - elseif entered_atruleafter =~ "^url(" - let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*") - let files = split(glob(filestart.'*'), '\n') - let values = map(copy(files), '"url(".v:val') - - else - let values = ['"', 'url('] - - endif - - else - return [] - - endif - - for m in values - if m =~? '^'.entered_atruleafter - call add(res, m) - elseif m =~? entered_atruleafter - call add(res2, m) - endif - endfor - - return res + res2 - - endif - - let values = ["charset", "page", "media", "import", "font-face"] - let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$') - - for m in values - if m =~? '^'.entered_atrule - call add(res, m .' ') - elseif m =~? entered_atrule - call add(res2, m .' ') - endif - endfor - - return res + res2 - -endif +function! csscomplete#CompleteCSS(findstart, base) -return [] + if a:findstart + " We need whole line to proper checking + let line = getline('.') + let start = col('.') - 1 + let compl_begin = col('.') - 2 + 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 + + " There are few chars important for context: + " ^ ; : { } /* */ + " Where ^ is start of line and /* */ are comment borders + " Depending on their relative position to cursor we will know what should + " be completed. + " 1. if nearest are ^ or { or ; current word is property + " 2. if : it is value (with exception of pseudo things) + " 3. if } we are outside of css definitions + " 4. for comments ignoring is be the easiest but assume they are the same + " as 1. + " 5. if @ complete at-rule + " 6. if ! complete important + if exists("b:compl_context") + let line = b:compl_context + let after = b:after + unlet! b:compl_context + else + let line = a:base + endif + + let res = [] + let res2 = [] + let borders = {} + + " Check last occurrence of sequence + + let openbrace = strridx(line, '{') + let closebrace = strridx(line, '}') + let colon = strridx(line, ':') + let semicolon = strridx(line, ';') + let opencomm = strridx(line, '/*') + let closecomm = strridx(line, '*/') + let style = strridx(line, 'style\s*=') + let atrule = strridx(line, '@') + let exclam = strridx(line, '!') + + if openbrace > -1 + let borders[openbrace] = "openbrace" + endif + if closebrace > -1 + let borders[closebrace] = "closebrace" + endif + if colon > -1 + let borders[colon] = "colon" + endif + if semicolon > -1 + let borders[semicolon] = "semicolon" + endif + if opencomm > -1 + let borders[opencomm] = "opencomm" + endif + if closecomm > -1 + let borders[closecomm] = "closecomm" + endif + if style > -1 + let borders[style] = "style" + endif + if atrule > -1 + let borders[atrule] = "atrule" + endif + if exclam > -1 + let borders[exclam] = "exclam" + endif + + + if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$' + " Complete properties + + + let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$') + + for m in s:values + if m =~? '^'.entered_property + call add(res, m . ':') + elseif m =~? entered_property + call add(res2, m . ':') + endif + endfor + + return res + res2 + + elseif borders[max(keys(borders))] == 'colon' + " Get name of property + let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$')) + + let wide_keywords = ["initial", "inherit", "unset"] + let color_values = ["transparent", "rgb(", "rgba(", "hsl(", "hsla(", "#"] + let border_style_values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] + let border_width_values = ["thin", "thick", "medium"] + let list_style_type_values = ["decimal", "decimal-leading-zero", "arabic-indic", "armenian", "upper-armenian", "lower-armenian", "bengali", "cambodian", "khmer", "cjk-decimal", "devanagari", "georgian", "gujarati", "gurmukhi", "hebrew", "kannada", "lao", "malayalam", "mongolian", "myanmar", "oriya", "persian", "lower-roman", "upper-roman", "tamil", "telugu", "thai", "tibetan", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "cjk-earthly-branch", "cjk-heavenly-stem", "lower-greek", "hiragana", "hiragana-iroha", "katakana", "katakana-iroha", "disc", "circle", "square", "disclosure-open", "disclosure-closed"] + let timing_functions = ["cubic-bezier(", "steps(", "linear", "ease", "ease-in", "ease-in-out", "ease-out", "step-start", "step-end"] + + if prop == 'all' + let values = [] + elseif prop == 'additive-symbols' + let values = [] + elseif prop == 'align-content' + let values = ["flex-start", "flex-end", "center", "space-between", "space-around", "stretch"] + elseif prop == 'align-items' + let values = ["flex-start", "flex-end", "center", "baseline", "stretch"] + elseif prop == 'align-self' + let values = ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"] + elseif prop == 'animation' + let values = timing_functions + ["normal", "reverse", "alternate", "alternate-reverse"] + ["none", "forwards", "backwards", "both"] + ["running", "paused"] + elseif prop == 'animation-delay' + let values = [] + elseif prop == 'animation-direction' + let values = ["normal", "reverse", "alternate", "alternate-reverse"] + elseif prop == 'animation-duration' + let values = [] + elseif prop == 'animation-fill-mode' + let values = ["none", "forwards", "backwards", "both"] + elseif prop == 'animation-iteration-count' + let values = [] + elseif prop == 'animation-name' + let values = [] + elseif prop == 'animation-play-state' + let values = ["running", "paused"] + elseif prop == 'animation-timing-function' + let values = timing_functions + elseif prop == 'background-attachment' + let values = ["scroll", "fixed"] + elseif prop == 'background-color' + let values = color_values + elseif prop == 'background-image' + let values = ["url(", "none"] + elseif prop == 'background-position' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z]\+\)\?$' + let values = ["top", "center", "bottom"] + elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = ["left", "center", "right"] + else + return [] + endif + elseif prop == 'background-repeat' + let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"] + elseif prop == 'background-size' + let values = ["auto", "contain", "cover"] + elseif prop == 'background' + let values = ["scroll", "fixed"] + color_values + ["url(", "none"] + ["top", "center", "bottom", "left", "right"] + ["repeat", "repeat-x", "repeat-y", "no-repeat"] + ["auto", "contain", "cover"] + elseif prop =~ 'border\%(-top\|-right\|-bottom\|-left\|-block-start\|-block-end\)\?$' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' + let values = border_width_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = border_style_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' + let values = color_values + else + return [] + endif + elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-color' + let values = color_values + elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-style' + let values = border_style_values + elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-width' + let values = border_width_values + elseif prop == 'border-color' + let values = color_values + elseif prop == 'border-style' + let values = border_style_values + elseif prop == 'border-width' + let values = border_width_values + elseif prop == 'bottom' + let values = ["auto"] + elseif prop == 'box-decoration-break' + let values = ["slice", "clone"] + elseif prop == 'box-shadow' + let values = ["inset"] + elseif prop == 'box-sizing' + let values = ["border-box", "content-box"] + elseif prop =~ 'break-\%(before\|after\)' + let values = ["auto", "always", "avoid", "left", "right", "page", "column", "region", "recto", "verso", "avoid-page", "avoid-column", "avoid-region"] + elseif prop == 'break-inside' + let values = ["auto", "avoid", "avoid-page", "avoid-column", "avoid-region"] + elseif prop == 'caption-side' + let values = ["top", "bottom"] + elseif prop == 'clear' + let values = ["none", "left", "right", "both"] + elseif prop == 'clip' + let values = ["auto", "rect("] + elseif prop == 'clip-path' + let values = ["fill-box", "stroke-box", "view-box", "none"] + elseif prop == 'color' + let values = color_values + elseif prop == 'columns' + let values = [] + elseif prop == 'column-count' + let values = ['auto'] + elseif prop == 'column-fill' + let values = ['auto', 'balance'] + elseif prop == 'column-rule-color' + let values = color_values + elseif prop == 'column-rule-style' + let values = border_style_values + elseif prop == 'column-rule-width' + let values = border_width_values + elseif prop == 'column-rule' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' + let values = border_width_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = border_style_values + elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' + let values = color_values + else + return [] + endif + elseif prop == 'column-span' + let values = ["none", "all"] + elseif prop == 'column-width' + let values = ["auto"] + elseif prop == 'content' + let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"] + elseif prop =~ 'counter-\%(increment\|reset\)$' + let values = ["none"] + elseif prop =~ 'cue\%(-after\|-before\)\=$' + let values = ["url("] + elseif prop == 'cursor' + let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"] + elseif prop == 'direction' + let values = ["ltr", "rtl"] + elseif prop == 'display' + let values = ["inline", "block", "list-item", "inline-list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none", "flex", "inline-flex", "grid", "inline-grid", "ruby", "ruby-base", "ruby-text", "ruby-base-container", "ruby-text-container", "contents"] + elseif prop == 'elevation' + let values = ["below", "level", "above", "higher", "lower"] + elseif prop == 'empty-cells' + let values = ["show", "hide"] + elseif prop == 'fallback' + let values = list_style_type_values + elseif prop == 'filter' + let values = ["blur(", "brightness(", "contrast(", "drop-shadow(", "grayscale(", "hue-rotate(", "invert(", "opacity(", "sepia(", "saturate("] + elseif prop == 'flex-basis' + let values = ["auto", "content"] + elseif prop == 'flex-flow' + let values = ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + elseif prop == 'flex-grow' + let values = [] + elseif prop == 'flex-shrink' + let values = [] + elseif prop == 'flex-wrap' + let values = ["nowrap", "wrap", "wrap-reverse"] + elseif prop == 'flex' + let values = ["nowrap", "wrap", "wrap-reverse"] + ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + ["auto", "content"] + elseif prop == 'float' + let values = ["left", "right", "none"] + elseif prop == 'font-family' + let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"] + elseif prop == 'font-feature-settings' + let values = ["normal", '"aalt"', '"abvf"', '"abvm"', '"abvs"', '"afrc"', '"akhn"', '"blwf"', '"blwm"', '"blws"', '"calt"', '"case"', '"ccmp"', '"cfar"', '"cjct"', '"clig"', '"cpct"', '"cpsp"', '"cswh"', '"curs"', '"cv', '"c2pc"', '"c2sc"', '"dist"', '"dlig"', '"dnom"', '"dtls"', '"expt"', '"falt"', '"fin2"', '"fin3"', '"fina"', '"flac"', '"frac"', '"fwid"', '"half"', '"haln"', '"halt"', '"hist"', '"hkna"', '"hlig"', '"hngl"', '"hojo"', '"hwid"', '"init"', '"isol"', '"ital"', '"jalt"', '"jp78"', '"jp83"', '"jp90"', '"jp04"', '"kern"', '"lfbd"', '"liga"', '"ljmo"', '"lnum"', '"locl"', '"ltra"', '"ltrm"', '"mark"', '"med2"', '"medi"', '"mgrk"', '"mkmk"', '"mset"', '"nalt"', '"nlck"', '"nukt"', '"numr"', '"onum"', '"opbd"', '"ordn"', '"ornm"', '"palt"', '"pcap"', '"pkna"', '"pnum"', '"pref"', '"pres"', '"pstf"', '"psts"', '"pwid"', '"qwid"', '"rand"', '"rclt"', '"rkrf"', '"rlig"', '"rphf"', '"rtbd"', '"rtla"', '"rtlm"', '"ruby"', '"salt"', '"sinf"', '"size"', '"smcp"', '"smpl"', '"ss01"', '"ss02"', '"ss03"', '"ss04"', '"ss05"', '"ss06"', '"ss07"', '"ss08"', '"ss09"', '"ss10"', '"ss11"', '"ss12"', '"ss13"', '"ss14"', '"ss15"', '"ss16"', '"ss17"', '"ss18"', '"ss19"', '"ss20"', '"ssty"', '"stch"', '"subs"', '"sups"', '"swsh"', '"titl"', '"tjmo"', '"tnam"', '"tnum"', '"trad"', '"twid"', '"unic"', '"valt"', '"vatu"', '"vert"', '"vhal"', '"vjmo"', '"vkna"', '"vkrn"', '"vpal"', '"vrt2"', '"zero"'] + elseif prop == 'font-kerning' + let values = ["auto", "normal", "none"] + elseif prop == 'font-language-override' + let values = ["normal"] + elseif prop == 'font-size' + let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"] + elseif prop == 'font-size-adjust' + let values = [] + elseif prop == 'font-stretch' + let values = ["normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"] + elseif prop == 'font-style' + let values = ["normal", "italic", "oblique"] + elseif prop == 'font-synthesis' + let values = ["none", "weight", "style"] + elseif prop == 'font-variant-alternates' + let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] + elseif prop == 'font-variant-caps' + let values = ["normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] + elseif prop == 'font-variant-asian' + let values = ["normal", "ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] + elseif prop == 'font-variant-ligatures' + let values = ["normal", "none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] + elseif prop == 'font-variant-numeric' + let values = ["normal", "ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] + elseif prop == 'font-variant-position' + let values = ["normal", "sub", "super"] + elseif prop == 'font-variant' + let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] + ["small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] + ["ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] + ["none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] + ["ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] + ["sub", "super"] + elseif prop == 'font-weight' + let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"] + elseif prop == 'font' + let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"] + elseif prop =~ '^\%(height\|width\)$' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop =~ '^\%(left\|rigth\)$' + let values = ["auto"] + elseif prop == 'image-rendering' + let values = ["auto", "crisp-edges", "pixelated"] + elseif prop == 'image-orientation' + let values = ["from-image", "flip"] + elseif prop == 'ime-mode' + let values = ["auto", "normal", "active", "inactive", "disabled"] + elseif prop == 'inline-size' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop == 'isolation' + let values = ["auto", "isolate"] + elseif prop == 'justify-content' + let values = ["flex-start", "flex-end", "center", "space-between", "space-around"] + elseif prop == 'letter-spacing' + let values = ["normal"] + elseif prop == 'line-break' + let values = ["auto", "loose", "normal", "strict"] + elseif prop == 'line-height' + let values = ["normal"] + elseif prop == 'list-style-image' + let values = ["url(", "none"] + elseif prop == 'list-style-position' + let values = ["inside", "outside"] + elseif prop == 'list-style-type' + let values = list_style_type_values + elseif prop == 'list-style' + let values = list_style_type_values + ["inside", "outside"] + ["url(", "none"] + elseif prop == 'margin' + let values = ["auto"] + elseif prop =~ 'margin-\%(right\|left\|top\|bottom\|block-start\|block-end\|inline-start\|inline-end\)$' + let values = ["auto"] + elseif prop == 'marks' + let values = ["crop", "cross", "none"] + elseif prop == 'mask' + let values = ["url("] + elseif prop == 'mask-type' + let values = ["luminance", "alpha"] + elseif prop == '\%(max\|min\)-\%(block\|inline\)-size' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop == '\%(max\|min\)-\%(height\|width\)' + let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"] + elseif prop == '\%(max\|min\)-zoom' + let values = ["auto"] + elseif prop == 'mix-blend-mode' + let values = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"] + elseif prop == 'opacity' + let values = [] + elseif prop == 'orientation' + let values = ["auto", "portrait", "landscape"] + elseif prop == 'orphans' + let values = [] + elseif prop == 'outline-offset' + let values = [] + elseif prop == 'outline-color' + let values = color_values + elseif prop == 'outline-style' + let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] + elseif prop == 'outline-width' + let values = ["thin", "thick", "medium"] + elseif prop == 'outline' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$' + let values = color_values + elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$' + let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] + elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' + let values = ["thin", "thick", "medium"] + else + return [] + endif + elseif prop == 'overflow-wrap' + let values = ["normal", "break-word"] + elseif prop =~ 'overflow\%(-x\|-y\)\=' + let values = ["visible", "hidden", "scroll", "auto"] + elseif prop == 'pad' + let values = [] + elseif prop == 'padding' + let values = [] + elseif prop =~ 'padding-\%(top\|right\|bottom\|left\|inline-start\|inline-end\|block-start\|block-end\)$' + let values = [] + elseif prop =~ 'page-break-\%(after\|before\)$' + let values = ["auto", "always", "avoid", "left", "right", "recto", "verso"] + elseif prop == 'page-break-inside' + let values = ["auto", "avoid"] + elseif prop =~ 'pause\%(-after\|-before\)\=$' + let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"] + elseif prop == 'perspective' + let values = ["none"] + elseif prop == 'perspective-origin' + let values = ["top", "bottom", "left", "center", " right"] + elseif prop == 'pointer-events' + let values = ["auto", "none", "visiblePainted", "visibleFill", "visibleStroke", "visible", "painted", "fill", "stroke", "all"] + elseif prop == 'position' + let values = ["static", "relative", "absolute", "fixed", "sticky"] + elseif prop == 'prefix' + let values = [] + elseif prop == 'quotes' + let values = ["none"] + elseif prop == 'range' + let values = ["auto", "infinite"] + elseif prop == 'resize' + let values = ["none", "both", "horizontal", "vertical"] + elseif prop =~ 'rest\%(-after\|-before\)\=$' + let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"] + elseif prop == 'ruby-align' + let values = ["start", "center", "space-between", "space-around"] + elseif prop == 'ruby-merge' + let values = ["separate", "collapse", "auto"] + elseif prop == 'ruby-position' + let values = ["over", "under", "inter-character"] + elseif prop == 'scroll-behavior' + let values = ["auto", "smooth"] + elseif prop == 'scroll-snap-coordinate' + let values = ["none"] + elseif prop == 'scroll-snap-destination' + return [] + elseif prop == 'scroll-snap-points-\%(x\|y\)$' + let values = ["none", "repeat("] + elseif prop == 'scroll-snap-type\%(-x\|-y\)\=$' + let values = ["none", "mandatory", "proximity"] + elseif prop == 'shape-image-threshold' + let values = [] + elseif prop == 'shape-margin' + let values = [] + elseif prop == 'shape-outside' + let values = ["margin-box", "border-box", "padding-box", "content-box", 'inset(', 'circle(', 'ellipse(', 'polygon(', 'url('] + elseif prop == 'speak' + let values = ["auto", "none", "normal"] + elseif prop == 'speak-as' + let values = ["auto", "normal", "spell-out", "digits"] + elseif prop == 'src' + let values = ["url("] + elseif prop == 'suffix' + let values = [] + elseif prop == 'symbols' + let values = [] + elseif prop == 'system' + let vals = matchstr(line, '.*:\s*\zs.*') + if vals =~ '^extends' + let values = list_style_type_values + else + let values = ["cyclic", "numeric", "alphabetic", "symbolic", "additive", "fixed", "extends"] + endif + elseif prop == 'table-layout' + let values = ["auto", "fixed"] + elseif prop == 'tab-size' + let values = [] + elseif prop == 'text-align' + let values = ["start", "end", "left", "right", "center", "justify", "match-parent"] + elseif prop == 'text-align-last' + let values = ["auto", "start", "end", "left", "right", "center", "justify"] + elseif prop == 'text-combine-upright' + let values = ["none", "all", "digits"] + elseif prop == 'text-decoration-line' + let values = ["none", "underline", "overline", "line-through", "blink"] + elseif prop == 'text-decoration-color' + let values = color_values + elseif prop == 'text-decoration-style' + let values = ["solid", "double", "dotted", "dashed", "wavy"] + elseif prop == 'text-decoration' + let values = ["none", "underline", "overline", "line-through", "blink"] + ["solid", "double", "dotted", "dashed", "wavy"] + color_values + elseif prop == 'text-emphasis-color' + let values = color_values + elseif prop == 'text-emphasis-position' + let values = ["over", "under", "left", "right"] + elseif prop == 'text-emphasis-style' + let values = ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"] + elseif prop == 'text-emphasis' + let values = color_values + ["over", "under", "left", "right"] + ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"] + elseif prop == 'text-indent' + let values = ["hanging", "each-line"] + elseif prop == 'text-orientation' + let values = ["mixed", "upright", "sideways", "sideways-right", "use-glyph-orientation"] + elseif prop == 'text-overflow' + let values = ["clip", "ellipsis"] + elseif prop == 'text-rendering' + let values = ["auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision"] + elseif prop == 'text-shadow' + let values = color_values + elseif prop == 'text-transform' + let values = ["capitalize", "uppercase", "lowercase", "full-width", "none"] + elseif prop == 'text-underline-position' + let values = ["auto", "under", "left", "right"] + elseif prop == 'touch-action' + let values = ["auto", "none", "pan-x", "pan-y", "manipulation", "pan-left", "pan-right", "pan-top", "pan-down"] + elseif prop == 'transform' + let values = ["matrix(", "translate(", "translateX(", "translateY(", "scale(", "scaleX(", "scaleY(", "rotate(", "skew(", "skewX(", "skewY(", "matrix3d(", "translate3d(", "translateZ(", "scale3d(", "scaleZ(", "rotate3d(", "rotateX(", "rotateY(", "rotateZ(", "perspective("] + elseif prop == 'transform-box' + let values = ["border-box", "fill-box", "view-box"] + elseif prop == 'transform-origin' + let values = ["left", "center", "right", "top", "bottom"] + elseif prop == 'transform-style' + let values = ["flat", "preserve-3d"] + elseif prop == 'top' + let values = ["auto"] + elseif prop == 'transition-property' + let values = ["all", "none"] + s:values + elseif prop == 'transition-duration' + let values = [] + elseif prop == 'transition-delay' + let values = [] + elseif prop == 'transition-timing-function' + let values = timing_functions + elseif prop == 'transition' + let values = ["all", "none"] + s:values + timing_functions + elseif prop == 'unicode-bidi' + let values = ["normal", "embed", "isolate", "bidi-override", "isolate-override", "plaintext"] + elseif prop == 'unicode-range' + let values = ["U+"] + elseif prop == 'user-zoom' + let values = ["zoom", "fixed"] + elseif prop == 'vertical-align' + let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"] + elseif prop == 'visibility' + let values = ["visible", "hidden", "collapse"] + elseif prop == 'voice-volume' + let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"] + elseif prop == 'voice-balance' + let values = ["left", "center", "right", "leftwards", "rightwards"] + elseif prop == 'voice-family' + let values = [] + elseif prop == 'voice-rate' + let values = ["normal", "x-slow", "slow", "medium", "fast", "x-fast"] + elseif prop == 'voice-pitch' + let values = ["absolute", "x-low", "low", "medium", "high", "x-high"] + elseif prop == 'voice-range' + let values = ["absolute", "x-low", "low", "medium", "high", "x-high"] + elseif prop == 'voice-stress' + let values = ["normal", "strong", "moderate", "none", "reduced "] + elseif prop == 'voice-duration' + let values = ["auto"] + elseif prop == 'white-space' + let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"] + elseif prop == 'widows' + let values = [] + elseif prop == 'will-change' + let values = ["auto", "scroll-position", "contents"] + s:values + elseif prop == 'word-break' + let values = ["normal", "break-all", "keep-all"] + elseif prop == 'word-spacing' + let values = ["normal"] + elseif prop == 'word-wrap' + let values = ["normal", "break-word"] + elseif prop == 'writing-mode' + let values = ["horizontal-tb", "vertical-rl", "vertical-lr", "sideways-rl", "sideways-lr"] + elseif prop == 'z-index' + let values = ["auto"] + elseif prop == 'zoom' + let values = ["auto"] + else + " If no property match it is possible we are outside of {} and + " trying to complete pseudo-(class|element) + let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$')) + if stridx('a,abbr,address,area,article,aside,audio,b,base,bdi,bdo,bgsound,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,div,dl,dt,element,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,main,map,mark,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,pre,progress,q,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,span,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,u,ul,var,video,wbr', ','.element.',') > -1 + let values = ["active", "any", "checked", "default", "dir(", "disabled", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "focus", "hover", "indeterminate", "in-range", "invalid", "lang(", "last-child", "last-of-type", "left", "link", "not(", "nth-child(", "nth-last-child(", "nth-last-of-type(", "nth-of-type(", "only-child", "only-of-type", "optional", "out-of-range", "read-only", "read-write", "required", "right", "root", "scope", "target", "valid", "visited", "first-line", "first-letter", "before", "after", "selection", "backdrop"] + else + return [] + endif + endif + + let values = wide_keywords + values + " Complete values + let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$') + + for m in values + if m =~? '^'.entered_value + call add(res, m) + elseif m =~? entered_value + call add(res2, m) + endif + endfor + + return res + res2 + + elseif borders[max(keys(borders))] == 'closebrace' + + return [] + + elseif borders[max(keys(borders))] == 'exclam' + + " Complete values + let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$') + + let values = ["important"] + + for m in values + if m =~? '^'.entered_imp + call add(res, m) + endif + endfor + + return res + + elseif borders[max(keys(borders))] == 'atrule' + + let afterat = matchstr(line, '.*@\zs.*') + + if afterat =~ '\s' + + let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze') + + if atrulename == 'media' + let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$') + + if entered_atruleafter =~ "([^)]*$" + let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs[^)]*$') + let values = ["max-width", "min-width", "width", "max-height", "min-height", "height", "max-aspect-ration", "min-aspect-ration", "aspect-ratio", "orientation", "max-resolution", "min-resolution", "resolution", "scan", "grid", "update-frequency", "overflow-block", "overflow-inline", "max-color", "min-color", "color", "max-color-index", "min-color-index", "color-index", "monochrome", "inverted-colors", "pointer", "hover", "any-pointer", "any-hover", "light-level", "scripting"] + else + let values = ["screen", "print", "speech", "all", "not", "and", "("] + endif + + elseif atrulename == 'supports' + let entered_atruleafter = matchstr(line, '.*@supports\s\+\zs.*$') + + if entered_atruleafter =~ "([^)]*$" + let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs.*$') + let values = s:values + else + let values = ["("] + endif + + elseif atrulename == 'charset' + let entered_atruleafter = matchstr(line, '.*@charset\s\+\zs.*$') + let values = [ + \ '"UTF-8";', '"ANSI_X3.4-1968";', '"ISO_8859-1:1987";', '"ISO_8859-2:1987";', '"ISO_8859-3:1988";', '"ISO_8859-4:1988";', '"ISO_8859-5:1988";', + \ '"ISO_8859-6:1987";', '"ISO_8859-7:1987";', '"ISO_8859-8:1988";', '"ISO_8859-9:1989";', '"ISO-8859-10";', '"ISO_6937-2-add";', '"JIS_X0201";', + \ '"JIS_Encoding";', '"Shift_JIS";', '"Extended_UNIX_Code_Packed_Format_for_Japanese";', '"Extended_UNIX_Code_Fixed_Width_for_Japanese";', + \ '"BS_4730";', '"SEN_850200_C";', '"IT";', '"ES";', '"DIN_66003";', '"NS_4551-1";', '"NF_Z_62-010";', '"ISO-10646-UTF-1";', '"ISO_646.basic:1983";', + \ '"INVARIANT";', '"ISO_646.irv:1983";', '"NATS-SEFI";', '"NATS-SEFI-ADD";', '"NATS-DANO";', '"NATS-DANO-ADD";', '"SEN_850200_B";', '"KS_C_5601-1987";', + \ '"ISO-2022-KR";', '"EUC-KR";', '"ISO-2022-JP";', '"ISO-2022-JP-2";', '"JIS_C6220-1969-jp";', '"JIS_C6220-1969-ro";', '"PT";', '"greek7-old";', + \ '"latin-greek";', '"NF_Z_62-010_(1973)";', '"Latin-greek-1";', '"ISO_5427";', '"JIS_C6226-1978";', '"BS_viewdata";', '"INIS";', '"INIS-8";', + \ '"INIS-cyrillic";', '"ISO_5427:1981";', '"ISO_5428:1980";', '"GB_1988-80";', '"GB_2312-80";', '"NS_4551-2";', '"videotex-suppl";', '"PT2";', + \ '"ES2";', '"MSZ_7795.3";', '"JIS_C6226-1983";', '"greek7";', '"ASMO_449";', '"iso-ir-90";', '"JIS_C6229-1984-a";', '"JIS_C6229-1984-b";', + \ '"JIS_C6229-1984-b-add";', '"JIS_C6229-1984-hand";', '"JIS_C6229-1984-hand-add";', '"JIS_C6229-1984-kana";', '"ISO_2033-1983";', + \ '"ANSI_X3.110-1983";', '"T.61-7bit";', '"T.61-8bit";', '"ECMA-cyrillic";', '"CSA_Z243.4-1985-1";', '"CSA_Z243.4-1985-2";', '"CSA_Z243.4-1985-gr";', + \ '"ISO_8859-6-E";', '"ISO_8859-6-I";', '"T.101-G2";', '"ISO_8859-8-E";', '"ISO_8859-8-I";', '"CSN_369103";', '"JUS_I.B1.002";', '"IEC_P27-1";', + \ '"JUS_I.B1.003-serb";', '"JUS_I.B1.003-mac";', '"greek-ccitt";', '"NC_NC00-10:81";', '"ISO_6937-2-25";', '"GOST_19768-74";', '"ISO_8859-supp";', + \ '"ISO_10367-box";', '"latin-lap";', '"JIS_X0212-1990";', '"DS_2089";', '"us-dk";', '"dk-us";', '"KSC5636";', '"UNICODE-1-1-UTF-7";', '"ISO-2022-CN";', + \ '"ISO-2022-CN-EXT";', '"ISO-8859-13";', '"ISO-8859-14";', '"ISO-8859-15";', '"ISO-8859-16";', '"GBK";', '"GB18030";', '"OSD_EBCDIC_DF04_15";', + \ '"OSD_EBCDIC_DF03_IRV";', '"OSD_EBCDIC_DF04_1";', '"ISO-11548-1";', '"KZ-1048";', '"ISO-10646-UCS-2";', '"ISO-10646-UCS-4";', '"ISO-10646-UCS-Basic";', + \ '"ISO-10646-Unicode-Latin1";', '"ISO-10646-J-1";', '"ISO-Unicode-IBM-1261";', '"ISO-Unicode-IBM-1268";', '"ISO-Unicode-IBM-1276";', + \ '"ISO-Unicode-IBM-1264";', '"ISO-Unicode-IBM-1265";', '"UNICODE-1-1";', '"SCSU";', '"UTF-7";', '"UTF-16BE";', '"UTF-16LE";', '"UTF-16";', '"CESU-8";', + \ '"UTF-32";', '"UTF-32BE";', '"UTF-32LE";', '"BOCU-1";', '"ISO-8859-1-Windows-3.0-Latin-1";', '"ISO-8859-1-Windows-3.1-Latin-1";', + \ '"ISO-8859-2-Windows-Latin-2";', '"ISO-8859-9-Windows-Latin-5";', '"hp-roman8";', '"Adobe-Standard-Encoding";', '"Ventura-US";', + \ '"Ventura-International";', '"DEC-MCS";', '"IBM850";', '"PC8-Danish-Norwegian";', '"IBM862";', '"PC8-Turkish";', '"IBM-Symbols";', '"IBM-Thai";', + \ '"HP-Legal";', '"HP-Pi-font";', '"HP-Math8";', '"Adobe-Symbol-Encoding";', '"HP-DeskTop";', '"Ventura-Math";', '"Microsoft-Publishing";', + \ '"Windows-31J";', '"GB2312";', '"Big5";', '"macintosh";', '"IBM037";', '"IBM038";', '"IBM273";', '"IBM274";', '"IBM275";', '"IBM277";', '"IBM278";', + \ '"IBM280";', '"IBM281";', '"IBM284";', '"IBM285";', '"IBM290";', '"IBM297";', '"IBM420";', '"IBM423";', '"IBM424";', '"IBM437";', '"IBM500";', '"IBM851";', + \ '"IBM852";', '"IBM855";', '"IBM857";', '"IBM860";', '"IBM861";', '"IBM863";', '"IBM864";', '"IBM865";', '"IBM868";', '"IBM869";', '"IBM870";', '"IBM871";', + \ '"IBM880";', '"IBM891";', '"IBM903";', '"IBM904";', '"IBM905";', '"IBM918";', '"IBM1026";', '"EBCDIC-AT-DE";', '"EBCDIC-AT-DE-A";', '"EBCDIC-CA-FR";', + \ '"EBCDIC-DK-NO";', '"EBCDIC-DK-NO-A";', '"EBCDIC-FI-SE";', '"EBCDIC-FI-SE-A";', '"EBCDIC-FR";', '"EBCDIC-IT";', '"EBCDIC-PT";', '"EBCDIC-ES";', + \ '"EBCDIC-ES-A";', '"EBCDIC-ES-S";', '"EBCDIC-UK";', '"EBCDIC-US";', '"UNKNOWN-8BIT";', '"MNEMONIC";', '"MNEM";', '"VISCII";', '"VIQR";', '"KOI8-R";', + \ '"HZ-GB-2312";', '"IBM866";', '"IBM775";', '"KOI8-U";', '"IBM00858";', '"IBM00924";', '"IBM01140";', '"IBM01141";', '"IBM01142";', '"IBM01143";', + \ '"IBM01144";', '"IBM01145";', '"IBM01146";', '"IBM01147";', '"IBM01148";', '"IBM01149";', '"Big5-HKSCS";', '"IBM1047";', '"PTCP154";', '"Amiga-1251";', + \ '"KOI7-switched";', '"BRF";', '"TSCII";', '"windows-1250";', '"windows-1251";', '"windows-1252";', '"windows-1253";', '"windows-1254";', '"windows-1255";', + \ '"windows-1256";', '"windows-1257";', '"windows-1258";', '"TIS-620";'] + + elseif atrulename == 'namespace' + let entered_atruleafter = matchstr(line, '.*@namespace\s\+\zs.*$') + let values = ["url("] + + elseif atrulename == 'document' + let entered_atruleafter = matchstr(line, '.*@document\s\+\zs.*$') + let values = ["url(", "url-prefix(", "domain(", "regexp("] + + elseif atrulename == 'import' + let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$') + + if entered_atruleafter =~ "^[\"']" + let filestart = matchstr(entered_atruleafter, '^.\zs.*') + let files = split(glob(filestart.'*'), '\n') + let values = map(copy(files), '"\"".v:val') + + elseif entered_atruleafter =~ "^url(" + let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*") + let files = split(glob(filestart.'*'), '\n') + let values = map(copy(files), '"url(".v:val') + + else + let values = ['"', 'url('] + + endif + + else + return [] + + endif + + for m in values + if m =~? '^'.entered_atruleafter + if entered_atruleafter =~? '^"' && m =~? '^"' + let m = m[1:] + endif + if b:after =~? '"' && stridx(m, '"') > -1 + let m = m[0:stridx(m, '"')-1] + endif + call add(res, m) + elseif m =~? entered_atruleafter + if m =~? '^"' + let m = m[1:] + endif + call add(res2, m) + endif + endfor + + return res + res2 + + endif + + let values = ["charset", "page", "media", "import", "font-face", "namespace", "supports", "keyframes", "viewport", "document"] + + let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$') + + for m in values + if m =~? '^'.entered_atrule + call add(res, m .' ') + elseif m =~? entered_atrule + call add(res2, m .' ') + endif + endfor + + return res + res2 + + endif + + return [] endfunction diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim new file mode 100644 index 0000000000..93ca4dfc54 --- /dev/null +++ b/runtime/autoload/health.vim @@ -0,0 +1,178 @@ +function! s:enhance_syntax() abort + syntax case match + + syntax keyword healthError ERROR + \ containedin=markdownCodeBlock,mkdListItemLine + highlight link healthError Error + + syntax keyword healthWarning WARNING + \ containedin=markdownCodeBlock,mkdListItemLine + highlight link healthWarning WarningMsg + + syntax keyword healthInfo INFO + \ containedin=markdownCodeBlock,mkdListItemLine + highlight link healthInfo ModeMsg + + syntax keyword healthSuccess SUCCESS + \ containedin=markdownCodeBlock,mkdListItemLine + highlight link healthSuccess ModeMsg + + syntax keyword healthSuggestion SUGGESTIONS + \ containedin=markdownCodeBlock,mkdListItemLine + highlight link healthSuggestion String + + syntax match healthHelp "|.\{-}|" contains=healthBar + \ containedin=markdownCodeBlock,mkdListItemLine + syntax match healthBar "|" contained conceal + highlight link healthHelp Identifier + + " We do not care about markdown syntax errors in :CheckHealth output. + highlight! link markdownError Normal +endfunction + +" 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 + 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 + endif + + " needed for plasticboy/vim-markdown, because it uses fdm=expr + normal! zR + setlocal nomodified + redraw|echo '' +endfunction + +" Starts a new report. +function! health#report_start(name) abort + echo "\n## " . a:name +endfunction + +" 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 + 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 + +" Changes ':h clipboard' to ':help |clipboard|'. +function! s:help_to_link(s) abort + return substitute(a:s, '\v[''"]?:h%[elp] ([^''"]+)[''"]?', '":help |\1|"', 'g') +endfunction + +" Format a message for a specific report item +function! s:format_report_message(status, msg, ...) abort " {{{ + let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4) + let suggestions = [] + + " Optional parameters + if a:0 > 0 + let suggestions = type(a:1) == type("") ? [a:1] : a:1 + if type(suggestions) != type([]) + echoerr "Expected String or List" + endif + endif + + " Report each suggestion + if len(suggestions) > 0 + let output .= "\n - SUGGESTIONS:" + endif + for suggestion in suggestions + let output .= "\n - " . s:indent_after_line1(suggestion, 10) + endfor + + return s:help_to_link(output) +endfunction " }}} + +" Use {msg} to report information in the current section +function! health#report_info(msg) abort " {{{ + echo s:format_report_message('INFO', a:msg) +endfunction " }}} + +" Reports a successful healthcheck. +function! health#report_ok(msg) abort " {{{ + echo s:format_report_message('SUCCESS', a:msg) +endfunction " }}} + +" Reports a health warning. +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 " }}} + +" Reports a failed healthcheck. +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 " }}} + +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 + +" Translates a list of plugin names to healthcheck function names. +function! s:to_fn_names(plugin_names) abort + let healthchecks = [] + for p in a:plugin_names + call add(healthchecks, 'health#'.p.'#check') + endfor + return healthchecks +endfunction + +" 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..e2ad9f7ccb --- /dev/null +++ b/runtime/autoload/health/nvim.vim @@ -0,0 +1,152 @@ +let s:suggest_faq = 'See https://github.com/neovim/neovim/wiki/FAQ' + +function! s:check_config() abort + call health#report_start('Configuration') + if !get(g:, 'loaded_sensible', 0) + call health#report_ok('no issues found') + else + let sensible_pi = globpath(&runtimepath, '**/sensible.vim', 1, 1) + call health#report_info("found sensible.vim plugin:\n".join(sensible_pi, "\n")) + call health#report_error("sensible.vim plugin is not needed; Nvim has the same defaults built-in." + \ ." Also, sensible.vim sets 'ttimeoutlen' to a sub-optimal value.", + \ ["Remove sensible.vim plugin, or wrap it in a `if !has('nvim')` check."]) + 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 = 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 $TERM + call health#report_info('$TERM: '.$TERM) + if $TERM !~# '\v(tmux-256color|screen-256color)' + call health#report_error( + \ '$TERM should be "screen-256color" or "tmux-256color" when running tmux.', + \ ["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 +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..417426c101 --- /dev/null +++ b/runtime/autoload/health/provider.vim @@ -0,0 +1,461 @@ +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 + +" 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 == 'stdout' || a:event == 'stderr' + let self.output .= join(a:data, '') + elseif a:event == 'exit' + let s:shell_error = a:data + endif +endfunction + +" Run a system command and timeout after 30 seconds. +function! s:system(cmd, ...) abort + let stdin = a:0 ? a:1 : '' + let ignore_stderr = a:0 > 1 ? a:2 : 0 + let ignore_error = a:0 > 2 ? a:3 : 0 + let opts = { + \ 'output': '', + \ 'on_stdout': function('s:system_handler'), + \ 'on_exit': function('s:system_handler'), + \ } + if !ignore_stderr + let opts.on_stderr = function('s:system_handler') + endif + let jobid = jobstart(a:cmd, opts) + + if jobid < 1 + call health#report_error(printf('Command error %d: %s', jobid, + \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))) + 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', + \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd)) + call jobstop(jobid) + elseif s:shell_error != 0 && !ignore_error + call health#report_error(printf("Command error (%d) %s: %s", jobid, + \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd, + \ opts.output)) + 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') + + let clipboard_tool = provider#clipboard#Executable() + if empty(clipboard_tool) + call health#report_warn( + \ "No clipboard tool found. Clipboard registers will not work.", + \ ['See ":help clipboard".']) + else + call health#report_ok('Clipboard tool found: '. clipboard_tool) + endif +endfunction + +" Get the latest Neovim Python client 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/neovim/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 python response' + endif + + let nvim_path = s:trim(s:system([ + \ a:python, '-c', '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) + 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(['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) + 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') + + let python_bin_name = 'python'.(a:version == 2 ? '' : '3') + let pyenv = resolve(exepath('pyenv')) + let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n' + let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : '' + let host_prog_var = python_bin_name.'_host_prog' + let python_bin = '' + let python_multiple = [] + + 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 [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version) + if empty(python_bin_name) + call health#report_warn('No Python interpreter was found with the neovim ' + \ . 'module. Using the first available for diagnostics.') + if !empty(pythonx_errs) + call health#report_warn(pythonx_errs) + endif + endif + + if !empty(python_bin_name) + if exists('g:'.host_prog_var) + let python_bin = exepath(python_bin_name) + endif + let python_bin_name = fnamemodify(python_bin_name, ':t') + endif + + if !empty(pythonx_errs) + call health#report_error('Python provider error', pythonx_errs) + endif + + if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs) + 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, python_bin_name)) + endif + + if !empty(pyenv) + if empty(pyenv_root) + call health#report_warn( + \ 'pyenv was found, but $PYENV_ROOT is not set.', + \ ['Did you follow the final install instructions?'] + \ ) + else + call health#report_ok(printf('pyenv found: "%s"', pyenv)) + endif + + let python_bin = s:trim(s:system([pyenv, 'which', python_bin_name], '', 1)) + + if empty(python_bin) + call health#report_warn(printf('pyenv could not 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 health#report_info(printf('Multiple %s executables found. ' + \ . 'Set `g:%s` to avoid surprises.', python_bin_name, host_prog_var)) + endif + + if python_bin =~# '\<shims\>' + call health#report_warn(printf('`%s` appears to be a pyenv shim.', python_bin), [ + \ 'The `pyenv` executable is not in $PATH,', + \ 'Your pyenv installation is broken. You should set ' + \ . '`g:'.host_prog_var.'` to avoid surprises.', + \ ]) + endif + endif + endif + endif + + if !empty(python_bin) + if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var) + \ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.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 Neovim''s Python module in each ' + \ . 'version/virtualenv.', host_prog_var) + \ ]) + elseif !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 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 Neovim''s Python module in each ' + \ . 'virtualenv.', host_prog_var) + \ ]) + endif + endif + endif + + if empty(python_bin) && !empty(python_bin_name) + " An error message should have already printed. + call health#report_error(printf('`%s` was not found.', python_bin_name)) + elseif !empty(python_bin) && !s:check_bin(python_bin) + let python_bin = '' + endif + + " Check if $VIRTUAL_ENV is active + let virtualenv_inactive = 0 + + if exists('$VIRTUAL_ENV') + if !empty(pyenv) + let pyenv_prefix = resolve(s:trim(s:system([pyenv, 'prefix']))) + if $VIRTUAL_ENV != pyenv_prefix + let virtualenv_inactive = 1 + endif + elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/' + let virtualenv_inactive = 1 + endif + endif + + if virtualenv_inactive + call health#report_warn( + \ '$VIRTUAL_ENV exists but appears to be inactive. ' + \ . 'This could lead to unexpected results.', + \ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229' ]) + endif + + " Diagnostic output + call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin)) + if len(python_multiple) + for path_bin in python_multiple + call health#report_info('Other python executable: ' . path_bin) + endfor + endif + + if !empty(python_bin) + let [pyversion, current, latest, status] = s:version_info(python_bin) + 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'.a:version.' version: ' . pyversion) + if s:is_bad_response(status) + call health#report_info(printf('%s-neovim version: %s (%s)', python_bin_name, current, status)) + else + call health#report_info(printf('%s-neovim version: %s', python_bin_name, current)) + endif + + if s:is_bad_response(current) + call health#report_error( + \ "Neovim Python client is not installed.\nError: ".current, + \ ['Run in shell: pip' . a:version . ' install neovim']) + 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 %s-neovim is NOT installed: %s', + \ python_bin_name, latest)) + elseif !s:is_bad_response(current) + call health#report_ok(printf('Latest %s-neovim is installed: %s', + \ python_bin_name, latest)) + endif + endif + +endfunction + +function! s:check_ruby() abort + call health#report_start('Ruby provider') + + 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('Missing "neovim" gem.', + \ ['Run in shell: gem install neovim']) + return + endif + call health#report_info('Host: '. host) + + let latest_gem_cmd = '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, ' (\|, \|)$' ), 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('Gem "neovim" is up-to-date: '. current_gem) + 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() +endfunction diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 0dfcc424e2..a6be00c0a9 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -1,137 +1,338 @@ -let s:man_tag_depth = 0 -let s:man_sect_arg = '' -let s:man_find_arg = '-w' +" Maintainer: Anmol Sethi <anmol@aubble.com> +let s:man_find_arg = "-w" + +" TODO(nhooyr) Completion may work on SunOS; I'm not sure if `man -l` displays +" the list of searched directories. try - if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~? '^5' - let s:man_sect_arg = '-s' + if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5' 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' +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 - let sect = get(a:000, 0) - let page = get(a:000, 1, sect) + call s:push_tag() + let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')') + if a:mods !~# 'tab' && s:find_man() + noautocmd execute 'silent edit' fnameescape(bufname) + else + noautocmd execute 'silent' a:mods 'split' fnameescape(bufname) + endif - let [page, sect] = s:parse_page_and_section(sect, page) + try + let page = s:get_page(path) + catch + close + call s:error(v:exception) + return + endtry - if !empty(sect) && s:find_page(sect, page) == 0 - let sect = '' - endif + let b:man_sect = sect + call s:put_page(page) +endfunction - if s:find_page(sect, page) == 0 - echo 'No manual entry for '.page +function! man#read_page(ref) abort + try + let [sect, name] = man#extract_sect_and_name_ref(a:ref) + let [b:man_sect, name, path] = s:verify_exists(sect, name) + let page = s:get_page(path) + catch + " call to s:error() is unnecessary return + endtry + call s:put_page(page) +endfunction + +" Handler for s:system() function. +function! s:system_handler(jobid, data, event) dict abort + if a:event == 'stdout' + let self.stdout .= join(a:data, "\n") + elseif a:event == 'stderr' + let self.stderr .= join(a:data, "\n") + else + let self.exit_code = a:data endif +endfunction - 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 - endif +" 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) - if &filetype !=# 'man' - let editcmd = 'tabnew' - endif + if jobid < 1 + throw printf('command error %d: %s', jobid, join(a:cmd)) + endif + + let res = jobwait([jobid], 30000) + if res[0] == -1 + try + call jobstop(jobid) + throw printf('command timed out: %s', join(a:cmd)) + catch /^Vim\%((\a\+)\)\=: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 - silent exec editcmd.' man://'.page.(empty(sect)?'':'('.sect.')') + return opts.stdout +endfunction +function! s:get_page(path) abort + " Respect $MANWIDTH or default to window width. + let manwidth = empty($MANWIDTH) ? winwidth(0) : $MANWIDTH + " Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db). + " http://comments.gmane.org/gmane.editors.vim.devel/29085 + return s:system(['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'man', a:path]) +endfunction + +function! s:put_page(page) abort setlocal modifiable - silent keepjumps norm! 1G"_dG - if empty($MANWIDTH) - let $MANWIDTH = winwidth(0) - endif - silent exec 'r!/usr/bin/man '.s:cmd(sect, page).' | col -b' - " Remove blank lines from top and bottom. + setlocal noreadonly + silent keepjumps %delete _ + silent put =a:page + " Remove all backspaced/escape characters. + execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g') while getline(1) =~# '^\s*$' silent keepjumps 1delete _ endwhile - while getline('$') =~# '^\s*$' - silent keepjumps $delete _ - endwhile - setlocal nomodified setlocal filetype=man +endfunction + +" 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 - if invoked_from_man || editcmd ==# 'tabnew' - call s:set_window_local_options() +function! s:get_path(sect, name) abort + if empty(a:sect) + return s:system(['man', s:man_find_arg, a:name]) endif + " '-s' flag handles: + " - tokens like 'printf(echo)' + " - sections starting with '-' + " - 3pcap section (found on macOS) + " - commas between sections (for section priority) + return s:system(['man', s:man_find_arg, '-s', a:sect, a:name]) endfunction -function s:set_window_local_options() abort - setlocal colorcolumn=0 foldcolumn=0 nonumber - setlocal nolist norelativenumber nofoldenable +function! s:verify_exists(sect, name) abort + let path = s:get_path(a:sect, a:name) + if path !~# '^\/' + let path = s:get_path(get(b:, 'man_default_sects', ''), a:name) + if path !~# '^\/' + let path = s:get_path('', a:name) + endif + endif + " We need to extract the section from the path because sometimes + " the actual section of the manpage is more specific than the section + " we provided to `man`. Try ':Man 3 App::CLI'. + " Also on linux, it seems that the name is case insensitive. So if one does + " ':Man PRIntf', we still want the name of the buffer to be 'printf' or + " whatever the correct capitilization is. + let path = path[:len(path)-2] + return s:extract_sect_and_name_path(path) + [path] 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 +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 -" Expects a string like 'access' or 'access(2)'. -function s:parse_page_and_section(sect, str) abort - try - let [page, sect] = matchlist(a:str, '\v\C([-.[:alnum:]_]+)%(\(([-.[:alnum:]_]+)\))?')[1:2] - if empty(sect) - let sect = a:sect +" 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 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:man_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 + " Remove all backspaced/escape characters. + execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g') + if getline(1) =~# '^\s*$' + silent keepjumps 1delete _ + else + keepjumps 1 + endif + " This is not perfect. See `man glDrawArraysInstanced`. Since the title is + " all caps it is impossible to tell what the original capitilization was. + let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g') + try + let b:man_sect = man#extract_sect_and_name_ref(ref)[0] + catch + let b:man_sect = '' + endtry + execute 'silent file man://'.fnameescape(ref) endfunction diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim index 2e2697c57f..a10ac32469 100644 --- a/runtime/autoload/msgpack.vim +++ b/runtime/autoload/msgpack.vim @@ -665,11 +665,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 53668b15be..de85844d5d 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Oct 23, 2015 -" Version: 154 +" Date: Apr 20, 2016 +" Version: 156 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2015 Charles E. Campbell {{{1 +" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -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) @@ -30,7 +30,7 @@ if v:version < 704 || !has("patch213") let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v154" +let g:loaded_netrw = "v156" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -55,7 +55,7 @@ setl cpo&vim " Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) " netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) " (this function can optionally take a list of messages) -" Oct 09, 2015 : max errnum currently is 102 +" Jan 19, 2016 : max errnum currently is 103 fun! netrw#ErrorMsg(level,msg,errnum) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) @@ -77,7 +77,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) " (default) netrw creates a one-line window to show error/warning " messages (reliably displayed) - " record current window number for NetrwRestorePosn()'s benefit + " record current window number let s:winBeforeErr= winnr() " call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("<slnum>")) @@ -416,18 +416,20 @@ if !exists("g:netrw_localmovecmd") let g:netrw_localmovecmd= "" endif endif -if exists("g:netrw_local_rmdir") - let g:netrw_localrmdir= g:netrw_local_rmdir - call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) -endif -if has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - call s:NetrwInit("g:netrw_localrmdir","rmdir") - else - let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir" - endif -else - call s:NetrwInit("g:netrw_localrmdir","rmdir") +if v:version < 704 || !has("patch1109") + if exists("g:netrw_local_rmdir") + let g:netrw_localrmdir= g:netrw_local_rmdir + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) + endif + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + call s:NetrwInit("g:netrw_localrmdir","rmdir") + else + let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir" + endif + else + call s:NetrwInit("g:netrw_localrmdir","rmdir") + endif endif call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) " sanity checks @@ -442,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") @@ -488,7 +490,9 @@ 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 call s:NetrwInit("g:netrw_timefmt","%c") if !exists("g:netrw_xstrlen") @@ -523,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 @@ -548,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= "" @@ -614,7 +619,7 @@ endif " == 4: Vexplore style == 5: Vexplore! " == 6: Texplore fun! netrw#Explore(indx,dosplit,style,...) -" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) +" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")." ft=".&ft) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() @@ -818,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 == "" @@ -1165,7 +1170,8 @@ fun! netrw#Lexplore(count,rightside,...) " call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>")) exe lexwinnr."wincmd w" let g:netrw_winsize = -winwidth(0) - let t:netrw_lexposn = netrw#SavePosn() + let t:netrw_lexposn = winsaveview() +" call Decho("saving posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>")) " call Decho("saving t:netrw_lexposn",'~'.expand("<slnum>")) close if lexwinnr < curwin @@ -1205,7 +1211,8 @@ fun! netrw#Lexplore(count,rightside,...) let t:netrw_lexbufnr = bufnr("%") if exists("t:netrw_lexposn") " call Decho("restoring to t:netrw_lexposn",'~'.expand("<slnum>")) - call netrw#RestorePosn(t:netrw_lexposn) +" call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>")) + call winrestview(t:netrw_lexposn) unlet t:netrw_lexposn endif endif @@ -1273,7 +1280,8 @@ endfun fun! netrw#MakeTgt(dname) " call Dfunc("netrw#MakeTgt(dname<".a:dname.">)") " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://') " call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>")) if s:netrwmftgt_islocal @@ -1290,7 +1298,8 @@ fun! netrw#MakeTgt(dname) if g:netrw_fastbrowse <= 1 call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir) endif - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))" + call winrestview(svpos) " call Dret("netrw#MakeTgt") endfun @@ -1532,9 +1541,11 @@ endfun " netrw#Nread: save position, call netrw#NetRead(), and restore position {{{2 fun! netrw#Nread(mode,fname) " call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)") - call netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call netrw#NetRead(a:mode,a:fname) - call netrw#RestorePosn() +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) if exists("w:netrw_liststyle") && w:netrw_liststyle != s:TREELIST if exists("w:netrw_bannercnt") @@ -1551,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 previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("<slnum>")) - NetrwKeepj call netrw#RestorePosn(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") @@ -1629,8 +1632,10 @@ fun! s:NetrwOptionRestore(vt) setl directory= unlet {a:vt}netrw_swfkeep elseif &l:swf != {a:vt}netrw_swfkeep - " following line causes a Press ENTER in windows -- can't seem to work around it!!! - sil! let &l:swf= {a:vt}netrw_swfkeep + if !g:netrw_use_noswf + " following line causes a Press ENTER in windows -- can't seem to work around it!!! + sil! let &l:swf= {a:vt}netrw_swfkeep + endif unlet {a:vt}netrw_swfkeep endif endif @@ -1645,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 previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("<slnum>")) - NetrwKeepj call netrw#RestorePosn(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>")) @@ -1729,11 +1725,11 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_rokeep = &l:ro let {a:vt}netrw_selkeep = &l:sel let {a:vt}netrw_spellkeep = &l:spell - if g:netrw_use_noswf - let {a:vt}netrw_swfkeep = &l:swf + if !g:netrw_use_noswf + let {a:vt}netrw_swfkeep = &l:swf endif if has("clipboard") - let {a:vt}netrw_starkeep = @* + let {a:vt}netrw_starkeep = @* endif let {a:vt}netrw_tskeep = &l:ts let {a:vt}netrw_twkeep = &l:tw " textwidth @@ -2664,7 +2660,9 @@ fun! netrw#NetSource(...) " call Decho("exe so ".fnameescape(s:netrw_tmpfile),'~'.expand("<slnum>")) exe "so ".fnameescape(s:netrw_tmpfile) " call Decho("delete(".s:netrw_tmpfile.")",'~'.expand("<slnum>")) - call delete(s:netrw_tmpfile) + if delete(s:netrw_tmpfile) + call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".s:netrw_tmpfile.">!",103) + endif unlet s:netrw_tmpfile else call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48) @@ -3003,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 @@ -3504,7 +3502,11 @@ fun! s:NetrwBookHistSave() let savefile= s:NetrwHome()."/.netrwhist" 1split call s:NetrwEnew() - setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf + if g:netrw_use_noswf + setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf + else + setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 + endif setl nocin noai noci magic nospell nohid wig= noaw setl ma noro write if exists("+acd") | setl noacd | endif @@ -3566,6 +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(),'~'.expand("<slnum>")) endif " s:NetrwBrowse : initialize history {{{3 @@ -3683,7 +3686,8 @@ fun! s:NetrwBrowse(islocal,dirname) " get/set-up buffer {{{3 " call Decho("saving position across a buffer refresh",'~'.expand("<slnum>")) - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let reusing= s:NetrwGetBuffer(a:islocal,dirname) " maintain markfile highlighting @@ -3754,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") @@ -3792,10 +3796,18 @@ fun! s:NetrwBrowse(islocal,dirname) NetrwKeepj call s:NetrwCommands(a:islocal) NetrwKeepj call s:PerformListing(a:islocal) + " restore option(s) + call s:NetrwOptionRestore("w:") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) + " If there is a rexposn: restore position with rexposn " Otherwise : set rexposn if exists("s:rexposn_".bufnr("%")) - NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) +" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(s:rexposn_{bufnr('%')}) + if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt + NetrwKeepj exe w:netrw_bannercnt + endif else NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) endif @@ -3804,13 +3816,11 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("set up balloon help: l:bexpr=".&l:bexpr,'~'.expand("<slnum>")) setl beval endif - call s:NetrwOptionRestore("w:") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " restore position if reusing -" call Decho("reusing=".reusing.": restoring position across buffer refresh",'~'.expand("<slnum>")) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) endif " The s:LocalBrowseRefresh() function is called by an autocmd @@ -3828,7 +3838,19 @@ endfun " differ from vim's. This function insures that netrw's idea of the current " directory is used. fun! s:NetrwFile(fname) -" call Dfunc("s:NetrwFile(fname<".a:fname.">)") +" call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr()) +" 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.">",'~'.expand("<slnum>")) + else + let fname= a:fname + endif if g:netrw_keepdir " vim's idea of the current directory possibly may differ from netrw's @@ -3837,29 +3859,31 @@ fun! s:NetrwFile(fname) endif if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) - if a:fname =~ '^\' || a:fname =~ '^\a:\' + if fname =~ '^\' || fname =~ '^\a:\' " windows, but full path given - let ret= a:fname -" call Decho("windows+full path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + let ret= fname +" call Decho("windows+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) else " windows, relative path given - let ret= s:ComposePath(b:netrw_curdir,a:fname) -" call Decho("windows+rltv path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + let ret= s:ComposePath(b:netrw_curdir,fname) +" call Decho("windows+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) endif - elseif a:fname =~ '^/' + elseif fname =~ '^/' " not windows, full path given - let ret= a:fname -" call Decho("unix+full path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + let ret= fname +" call Decho("unix+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) else " not windows, relative path given - let ret= s:ComposePath(b:netrw_curdir,a:fname) -" call Decho("unix+rltv path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + let ret= s:ComposePath(b:netrw_curdir,fname) +" call Decho("unix+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) endif else " vim and netrw agree on the current directory - let ret= a:fname + 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) @@ -3872,23 +3896,29 @@ fun! s:NetrwFileInfo(islocal,fname) " call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">) b:netrw_curdir<".b:netrw_curdir.">") let ykeep= @@ if a:islocal + let lsopt= "-lsad" + if g:netrw_sizestyle =~# 'H' + let lsopt= "-lsadh" + elseif g:netrw_sizestyle =~# 'h' + let lsopt= "-lsadh --si" + endif if (has("unix") || has("macunix")) && executable("/bin/ls") if getline(".") == "../" - echo system("/bin/ls -lsad ".s:ShellEscape("..")) + echo system("/bin/ls ".lsopt." ".s:ShellEscape("..")) " call Decho("#1: echo system(/bin/ls -lsad ".s:ShellEscape(..).")",'~'.expand("<slnum>")) elseif w:netrw_liststyle == s:TREELIST && getline(".") !~ '^'.s:treedepthstring - echo system("/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir)) + echo system("/bin/ls ".lsopt." ".s:ShellEscape(b:netrw_curdir)) " call Decho("#2: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir).")",'~'.expand("<slnum>")) elseif exists("b:netrw_curdir") - echo system("/bin/ls -lsad ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname))) + echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname))) " call Decho("#3: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir.a:fname).")",'~'.expand("<slnum>")) else " call Decho('using ls '.a:fname." using cwd<".getcwd().">",'~'.expand("<slnum>")) - echo system("/bin/ls -lsad ".s:ShellEscape(s:NetrwFile(a:fname))) + echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:NetrwFile(a:fname))) " call Decho("#5: echo system(/bin/ls -lsad ".s:ShellEscape(a:fname).")",'~'.expand("<slnum>")) endif else @@ -3901,6 +3931,9 @@ fun! s:NetrwFileInfo(islocal,fname) endif let t = getftime(s:NetrwFile(fname)) let sz = getfsize(s:NetrwFile(fname)) + if g:netrw_sizestyle =~# "[hH]" + let sz= s:NetrwHumanReadable(sz) + endif echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname))) " call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)),'~'.expand("<slnum>")) endif @@ -3912,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>")) @@ -4029,11 +4003,15 @@ fun! s:NetrwGetBuffer(islocal,dirname) let w:netrw_treebufnr= bufnr("%") " call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum),'~'.expand("<slnum>")) exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) - setl bt=nofile noswf - nnoremap <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> - nnoremap <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> - nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[')<cr> - nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']')<cr> + if g:netrw_use_noswf + setl nobl bt=nofile noswf + else + setl nobl bt=nofile + endif + nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[[')<cr> + nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']]')<cr> + nnoremap <silent> <buffer> [] :sil call <SID>TreeListMove('[]')<cr> + nnoremap <silent> <buffer> ][ :sil call <SID>TreeListMove('][')<cr> " call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr,'~'.expand("<slnum>")) else " let v:errmsg = "" " Decho @@ -4043,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>")) @@ -4050,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 @@ -4165,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' @@ -4197,7 +4179,7 @@ fun! s:NetrwGetWord() NetrwKeepj norm! 0 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') - elseif w:netrw_liststyle == s:TREELIST + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Decho("treelist handling",'~'.expand("<slnum>")) let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') let dirname= substitute(dirname,'\t -->.*$','','') @@ -4286,7 +4268,8 @@ fun! s:NetrwListStyle(islocal) let ykeep = @@ let fname = s:NetrwGetWord() if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST " call Decho("fname<".fname.">",'~'.expand("<slnum>")) " call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("<slnum>")) @@ -4307,7 +4290,7 @@ fun! s:NetrwListStyle(islocal) " call Decho("use wide list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - elseif w:netrw_liststyle == s:TREELIST + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Decho("use tree list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') @@ -4334,7 +4317,8 @@ fun! s:NetrwListStyle(islocal) NetrwKeepj call s:NetrwCursor() " restore position; keep cursor on the filename - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) @@ -4350,7 +4334,8 @@ fun! s:NetrwBannerCtrl(islocal) let g:netrw_banner= !g:netrw_banner " refresh the listing - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) " keep cursor on the filename @@ -4385,7 +4370,8 @@ fun! s:NetrwBookmark(del,...) if exists("s:netrwmarkfilelist_{curbufnr}") " for every filename in the marked list " call Decho("bookmark every filename in marked list",'~'.expand("<slnum>")) - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let islocal= expand("%") !~ '^\a\{3,}://' for fname in s:netrwmarkfilelist_{curbufnr} if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif @@ -4393,7 +4379,8 @@ fun! s:NetrwBookmark(del,...) let curdir = exists("b:netrw_curdir")? b:netrw_curdir : getcwd() call s:NetrwUnmarkList(curbufnr,curdir) NetrwKeepj call s:NetrwRefresh(islocal,s:NetrwBrowseChgDir(islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else let fname= s:NetrwGetWord() if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif @@ -4416,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}] @@ -4523,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 = netrw#SavePosn() - let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos -" call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn",'~'.expand("<slnum>")) if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -4546,14 +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 - NetrwKeepj call netrw#RestorePosn(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 @@ -4577,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 @@ -4585,8 +4571,8 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>")) " save position for benefit of Rexplore - let s:rexposn_{bufnr("%")}= netrw#SavePosn() -" call Decho("edit-a-file: setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>")) + let s:rexposn_{bufnr("%")}= winsaveview() +" call Decho("edit-a-file: saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>")) " call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>")) " call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">",'~'.expand("<slnum>")) @@ -4602,6 +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.">",'~'.expand("<slnum>")) let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) @@ -4609,8 +4596,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")",'~'.expand("<slnum>")) " this lets netrw#BrowseX avoid the edit if a:0 < 1 -" call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>")) +" call Decho("edit-a-file: (a:0=".a:0."<1) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionRestore("s:") + let curdir= b:netrw_curdir if !exists("s:didsplit") " call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("<slnum>")) if type(g:netrw_browse_split) == 3 @@ -4627,6 +4615,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !&ea keepalt wincmd _ endif + 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>")) @@ -4634,10 +4623,15 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !&ea keepalt wincmd | endif + 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 + 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>")) @@ -4646,6 +4640,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dret("s:NetrwBrowseChgDir") return endif + 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>")) @@ -4663,6 +4658,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" endif + call s:SetRexDir(a:islocal,curdir) endif endif @@ -4797,12 +4793,12 @@ 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>")) " search treedict for tree dir as-is -" call Decho("search treedict for tree dir as-is",'~'.expand("<slnum>")) +" call Decho("tree-list: search treedict for tree dir as-is",'~'.expand("<slnum>")) if has_key(w:netrw_treedict,treedir) " call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("<slnum>")) let haskey= 1 @@ -4811,7 +4807,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif " search treedict for treedir with a [/@] appended -" call Decho("search treedict for treedir with a [/@] appended",'~'.expand("<slnum>")) +" call Decho("tree-list: search treedict for treedir with a [/@] appended",'~'.expand("<slnum>")) if !haskey && treedir !~ '[/@]$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" @@ -4823,7 +4819,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif " search treedict for treedir with any trailing / elided -" call Decho("search treedict for treedir with any trailing / elided",'~'.expand("<slnum>")) +" call Decho("tree-list: search treedict for treedir with any trailing / elided",'~'.expand("<slnum>")) if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) @@ -4873,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) @@ -4908,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>")) @@ -4947,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 @@ -4967,14 +4970,15 @@ fun! netrw#BrowseX(fname,remote) " call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")") " if its really just a directory, then do a "gf" instead - if a:fname =~ '/$' + if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && fname =~ '/$' && fname !~ '^https\=:') norm! gf " call Dret("netrw#BrowseX : did gf instead") endif let ykeep = @@ - let screenposn = netrw#SavePosn() + let screenposn = winsaveview() +" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) " need to save and restore aw setting as gx can invoke this function from non-netrw buffers let awkeep = &aw @@ -4996,7 +5000,8 @@ fun! netrw#BrowseX(fname,remote) endif endfor endif - call netrw#RestorePosn(screenposn) +" call Decho("restoring posn to screenposn<".string(screenposn).">,'~'.expand("<slnum>"))" + call winrestview(screenposn) let @@= ykeep let &aw= awkeep " call Dret("netrw#BrowseX : coredump handler invoked") @@ -5041,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>")) @@ -5167,7 +5175,8 @@ fun! netrw#BrowseX(fname,remote) exe "sil! NetrwKeepj norm! \<c-o>" " redraw! endif - call netrw#RestorePosn(screenposn) +" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) + call winrestview(screenposn) let @@ = ykeep let &aw= awkeep @@ -5310,6 +5319,43 @@ fun! s:NetrwForceChgDir(islocal,newdir) endfun " --------------------------------------------------------------------- +" s:NetrwGlob: does glob() if local, remote listing otherwise {{{2 +" 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 + let keep_liststyle = w:netrw_liststyle + let w:netrw_liststyle = s:THINLIST + if s:NetrwRemoteListing() == 0 + keepj keepalt %s@/@@ + let filelist= getline(1,$) + q! + else + " remote listing error -- leave treedict unchanged + 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(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 +endfun + +" --------------------------------------------------------------------- " s:NetrwForceFile: (gf support) Force treatment as a file {{{2 fun! s:NetrwForceFile(islocal,newfile) " call Dfunc("s:NetrwForceFile(islocal=".a:islocal." newdir<".a:newfile.">)") @@ -5336,7 +5382,8 @@ endfun fun! s:NetrwHide(islocal) " call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide) let ykeep= @@ - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{bufnr('%')}") " call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">",'~'.expand("<slnum>")) @@ -5378,7 +5425,8 @@ fun! s:NetrwHide(islocal) endif NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("NetrwHide") endfun @@ -5390,7 +5438,8 @@ fun! s:NetrwHideEdit(islocal) let ykeep= @@ " save current cursor position - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) " get new hiding list from user call inputsave() @@ -5403,7 +5452,8 @@ fun! s:NetrwHideEdit(islocal) sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) " restore cursor position - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) let @@= ykeep " call Dret("NetrwHideEdit") @@ -5415,7 +5465,8 @@ fun! s:NetrwHidden(islocal) " call Dfunc("s:NetrwHidden()") let ykeep= @@ " save current position - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+' " remove pattern from hiding list @@ -5428,7 +5479,8 @@ fun! s:NetrwHidden(islocal) " refresh screen and return to saved position NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("s:NetrwHidden") endfun @@ -5540,10 +5592,10 @@ fun! s:NetrwServerEdit(islocal,fname) if (islocal && isdirectory(s:NetrwFile(a:fname))) || (!islocal && a:fname =~ '/$') " handle directories in the local window -- not in the remote vim server - " user must have closed the NETRWSERVER window. Treat as a normal editing from netrw. + " user must have closed the NETRWSERVER window. Treat as normal editing from netrw. " call Decho("handling directory in client window",'~'.expand("<slnum>")) let g:netrw_browse_split= 0 - if exists("s:netrw_browse_split_".winnr()) + if exists("s:netrw_browse_split") && exists("s:netrw_browse_split_".winnr()) let g:netrw_browse_split= s:netrw_browse_split_{winnr()} unlet s:netrw_browse_split_{winnr()} endif @@ -5820,9 +5872,11 @@ fun! s:NetrwMakeDir(usrhost) if v:shell_error == 0 " refresh listing " call Decho("refresh listing",'~'.expand("<slnum>")) - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) elseif !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26) endif @@ -5836,9 +5890,11 @@ fun! s:NetrwMakeDir(usrhost) call s:NetrwExe("sil! !".mkdircmd." ".s:ShellEscape(newdirname,1)) if v:shell_error == 0 " refresh listing - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) elseif !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) endif @@ -5846,7 +5902,8 @@ fun! s:NetrwMakeDir(usrhost) elseif b:netrw_method == 2 " Remote mkdir: using ftp+.netrc - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) if exists("b:netrw_fname") " call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) @@ -5856,11 +5913,13 @@ fun! s:NetrwMakeDir(usrhost) endif call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) elseif b:netrw_method == 3 " Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc) - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) if exists("b:netrw_fname") " call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) @@ -5870,7 +5929,8 @@ fun! s:NetrwMakeDir(usrhost) endif call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) endif let @@= ykeep @@ -5884,22 +5944,30 @@ fun! s:TreeSqueezeDir(islocal) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " its a tree-listing style let curdepth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') - let iline = line(".") - 1 let stopline = (exists("w:netrw_bannercnt")? (w:netrw_bannercnt + 1) : 1) -" call Decho("curdepth=".curdepth,'~'.expand("<slnum>")) + let depth = strchars(substitute(curdepth,' ','','g')) + let srch = -1 +" call Decho("curdepth<".curdepth.'>','~'.expand("<slnum>")) +" call Decho("depth =".depth,'~'.expand("<slnum>")) " call Decho("stopline#".stopline,'~'.expand("<slnum>")) -" call Decho("starting with line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) - while iline > stopline - " find a line that has less depth - let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("considering line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) - if depth < curdepth - break - endif - norm! k - endwhile -" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) - call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord())) +" call Decho("curline#".line(".")."<".getline('.').'>','~'.expand("<slnum>")) + if depth >= 2 + NetrwKeepj norm! 0 + let curdepthm1= substitute(curdepth,'^'.s:treedepthstring,'','') + let srch = search('^'.curdepthm1.'\%('.s:treedepthstring.'\)\@!','bW',stopline) +" call Decho("curdepthm1<".curdepthm1.'>','~'.expand("<slnum>")) +" call Decho("case depth>=2: srch<".srch.'>','~'.expand("<slnum>")) + elseif depth == 1 + NetrwKeepj norm! 0 + let treedepthchr= substitute(s:treedepthstring,' ','','') + let srch = search('^[^'.treedepthchr.']','bW',stopline) +" call Decho("case depth==1: srch<".srch.'>','~'.expand("<slnum>")) + endif + if srch > 0 +" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) + call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord())) + exe srch + endif endif " call Dret("s:TreeSqueezeDir") endfun @@ -5927,23 +5995,24 @@ fun! s:NetrwMaps(islocal) if a:islocal " call Decho("make local maps",'~'.expand("<slnum>")) " local normal-mode maps - nnoremap <buffer> <silent> <nowait> a :call <SID>NetrwHide(1)<cr> - nnoremap <buffer> <silent> <nowait> % :call <SID>NetrwOpenFile(1)<cr> - nnoremap <buffer> <silent> <nowait> c :call <SID>NetrwLcd(b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(1)<cr> + nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(1)<cr> + nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(1)<cr> + nnoremap <buffer> <silent> <nowait> c :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr> nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> <nowait> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <nowait> <s-cr> :call <SID>TreeSqueezeDir(1)<cr> - nnoremap <buffer> <silent> <nowait> <c-r> :call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("")<cr> - nnoremap <buffer> <silent> <nowait> - :call <SID>NetrwBrowseUpDir(1)<cr> + nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> d :<c-u>call <SID>NetrwMakeDir("")<cr> nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(1)<cr> nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> <nowait> I :call <SID>NetrwBannerCtrl(1)<cr> - nnoremap <buffer> <silent> <nowait> i :call <SID>NetrwListStyle(1)<cr> + nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr> + nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(1)<cr> + nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(1,0)<cr> + nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(1,1)<cr> nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr> @@ -5957,104 +6026,110 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr> nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr> - nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr> nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr> + nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr> nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr> nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr> - nnoremap <buffer> <silent> <nowait> O :call <SID>NetrwObtain(1)<cr> + nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(1)<cr> nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(3)<cr> - nnoremap <buffer> <silent> <nowait> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - nnoremap <buffer> <silent> <nowait> P :call <SID>NetrwPrevWinOpen(1)<cr> + nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(1)<cr> nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> 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> r :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> 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> s :call <SID>NetrwSortStyle(1)<cr> - nnoremap <buffer> <silent> <nowait> S :call <SID>NetSortSequence(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> nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(4)<cr> - nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> + nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr> nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(5)<cr> - nnoremap <buffer> <silent> <nowait> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> - nnoremap <buffer> <silent> <nowait> X :call <SID>NetrwLocalExecute(expand("<cword>"))"<cr> - " local insert-mode maps - inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(1)<cr> - inoremap <buffer> <silent> <nowait> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> - inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(1)<cr> - inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr> - inoremap <buffer> <silent> <nowait> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> - inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(1)<cr> - inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr> - inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr> - nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> - inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(1)<cr> - inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr> - inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr> - inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr> - inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr> - inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr> - inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr> - inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr> - inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> - inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr> - inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr> - inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr> - inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr> - inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> - inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> - inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> - inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr> - inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(1)<cr> - inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(3)<cr> - inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> - inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - 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> 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> - inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> - inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> - inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(5)<cr> - inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> + nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> + nnoremap <buffer> <silent> <nowait> X :<c-u>call <SID>NetrwLocalExecute(expand("<cword>"))"<cr> +" " local insert-mode maps +" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(1)<cr> +" inoremap <buffer> <silent> <nowait> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> +" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(1)<cr> +" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr> +" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> +" inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr> +" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr> +" nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> +" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(1)<cr> +" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr> +" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr> +" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr> +" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr> +" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr> +" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr> +" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr> +" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> +" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr> +" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr> +" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr> +" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr> +" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> +" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> +" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> +" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr> +" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(1)<cr> +" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(3)<cr> +" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> +" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> +" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> +" 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> 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> +" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr> +" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr> +" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> +" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> +" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(5)<cr> +" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit - imap <buffer> <unique> <c-h> <Plug>NetrwHideEdit +" imap <buffer> <unique> <c-h> <c-o><Plug>NetrwHideEdit endif - nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr> + nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr> if !hasmapto('<Plug>NetrwRefresh') nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh - imap <buffer> <unique> <c-l> <Plug>NetrwRefresh +" imap <buffer> <unique> <c-l> <c-o><Plug>NetrwRefresh endif - nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr> + nnoremap <buffer> <silent> <Plug>NetrwRefresh <c-l>:call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr> if s:didstarstar || !mapcheck("<s-down>","n") nnoremap <buffer> <silent> <s-down> :Nexplore<cr> - inoremap <buffer> <silent> <s-down> :Nexplore<cr> +" inoremap <buffer> <silent> <s-down> <c-o>:Nexplore<cr> endif if s:didstarstar || !mapcheck("<s-up>","n") nnoremap <buffer> <silent> <s-up> :Pexplore<cr> - inoremap <buffer> <silent> <s-up> :Pexplore<cr> +" inoremap <buffer> <silent> <s-up> <c-o>:Pexplore<cr> endif + if !hasmapto('<Plug>NetrwTreeSqueeze') + nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze +" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze + endif + nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(1)<cr> let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) if g:netrw_mousemaps == 1 - nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse + nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(1)<cr> @@ -6067,14 +6142,14 @@ fun! s:NetrwMaps(islocal) nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse nmap <buffer> <silent> <Plug>Netrw2Leftmouse - imap <buffer> <leftmouse> <Plug>ILeftmouse - ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> +" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> imap <buffer> <middlemouse> <Plug>IMiddlemouse - ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> - imap <buffer> <s-leftmouse> <Plug>ISLeftmouse - ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> +" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> +" imap <buffer> <s-leftmouse> <Plug>ISLeftmouse +" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' endif exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' @@ -6083,10 +6158,10 @@ fun! s:NetrwMaps(islocal) exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> " support user-specified maps @@ -6096,13 +6171,24 @@ fun! s:NetrwMaps(islocal) " call Decho("make remote maps",'~'.expand("<slnum>")) call s:RemotePathAnalysis(b:netrw_curdir) " remote normal-mode maps - nnoremap <buffer> <silent> <nowait> <cr> :call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <nowait> <s-cr> :call <SID>TreeSqueezeDir(0)<cr> - nnoremap <buffer> <silent> <nowait> <c-l> :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - nnoremap <buffer> <silent> <nowait> <c-r> :call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> <nowait> - :call <SID>NetrwBrowseUpDir(0)<cr> - nnoremap <buffer> <silent> <nowait> a :call <SID>NetrwHide(0)<cr> + nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(0)<cr> + nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(0)<cr> + nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(0)<cr> + nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> + nnoremap <buffer> <silent> <nowait> <c-l> :<c-u>call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr> + nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr> + nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(0)<cr> + nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(0,0)<cr> + nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(0,1)<cr> nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr> nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr> nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr> @@ -6114,99 +6200,96 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr> nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr> - nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr> nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr> + nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr> nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr> nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr> - nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr> - nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> <nowait> i :call <SID>NetrwListStyle(0)<cr> - nnoremap <buffer> <silent> <nowait> I :call <SID>NetrwBannerCtrl(1)<cr> - nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(0)<cr> - nnoremap <buffer> <silent> <nowait> O :call <SID>NetrwObtain(0)<cr> - nnoremap <buffer> <silent> <nowait> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - nnoremap <buffer> <silent> <nowait> P :call <SID>NetrwPrevWinOpen(0)<cr> + nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(0)<cr> + nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(0)<cr> + nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(0)<cr> nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> 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> r :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 :call <SID>NetSortSequence(0)<cr> - nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(1)<cr> - nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr> - nnoremap <buffer> <silent> <nowait> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> - nnoremap <buffer> <silent> <nowait> % :call <SID>NetrwOpenFile(0)<cr> - " remote insert-mode maps - inoremap <buffer> <silent> <nowait> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> - inoremap <buffer> <silent> <nowait> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr> - inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr> - inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(0)<cr> - inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr> - inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr> - inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr> - inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr> - inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr> - inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr> - inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr> - inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> - inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr> - inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr> - inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr> - inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr> - nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> - inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> - inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> - inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> - inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr> - inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr> - inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> - inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(0)<cr> - inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> - inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(0)<cr> - inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(0)<cr> - inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr> - inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - 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> 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> - inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> - inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(2)<cr> - inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> - inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(0)<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> 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> + nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(1)<cr> + nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(0,'h',v:count)<cr> + nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr> + nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> +" " remote insert-mode maps +" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> +" inoremap <buffer> <silent> <nowait> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> +" inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr> +" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr> +" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(0)<cr> +" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr> +" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr> +" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr> +" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> +" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr> +" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr> +" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr> +" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr> +" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> +" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr> +" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr> +" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr> +" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr> +" nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> +" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> +" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> +" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> +" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr> +" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr> +" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> +" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(0)<cr> +" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> +" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(0)<cr> +" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(0)<cr> +" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> +" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr> +" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> +" 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> 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> +" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> +" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> +" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> +" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(2)<cr> +" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> +" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(0)<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <c-h> <Plug>NetrwHideEdit - imap <buffer> <c-h> <Plug>NetrwHideEdit +" imap <buffer> <c-h> <Plug>NetrwHideEdit endif nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(0)<cr> if !hasmapto('<Plug>NetrwRefresh') nmap <buffer> <c-l> <Plug>NetrwRefresh - imap <buffer> <c-l> <Plug>NetrwRefresh +" imap <buffer> <c-l> <Plug>NetrwRefresh endif + if !hasmapto('<Plug>NetrwTreeSqueeze') + nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze +" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze + endif + nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(0)<cr> let mapsafepath = escape(s:path, s:netrw_map_escape) let mapsafeusermach = escape(((s:user == "")? "" : s:user."@").s:machine, s:netrw_map_escape) @@ -6226,14 +6309,14 @@ fun! s:NetrwMaps(islocal) nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse nmap <buffer> <silent> <Plug>Netrw2Leftmouse - imap <buffer> <leftmouse> <Plug>ILeftmouse - ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr> +" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr> imap <buffer> <middlemouse> <Plug>IMiddlemouse - ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr> +" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr> imap <buffer> <s-leftmouse> <Plug>ISLeftmouse - ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> +" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' endif exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' @@ -6242,12 +6325,12 @@ fun! s:NetrwMaps(islocal) exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' +" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> - inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr> +" inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr> " support user-specified maps call netrw#UserMaps(0) @@ -6257,7 +6340,7 @@ fun! s:NetrwMaps(islocal) endfun " --------------------------------------------------------------------- -" s:NetrwCommands: sets up commands {{{2 +" s:NetrwCommands: set up commands {{{2 " If -buffer, the command is only available from within netrw buffers " Otherwise, the command is available from any window, so long as netrw " has been used at least once in the session. @@ -6266,7 +6349,7 @@ fun! s:NetrwCommands(islocal) com! -nargs=* -complete=file -bang NetrwMB call s:NetrwBookmark(<bang>0,<f-args>) com! -nargs=* NetrwC call s:NetrwSetChgwin(<q-args>) - com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"not a former netrw window",79)|endif + com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"win#".winnr()." not a former netrw window",79)|endif if a:islocal com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,<f-args>) else @@ -6286,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}] @@ -6319,9 +6402,11 @@ fun! s:NetrwMarkTarget(...) let s:netrwmftgt = tgt let s:netrwmftgt_islocal = tgt !~ '^\a\{3,}://' let curislocal = b:netrw_curdir !~ '^\a\{3,}://' - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call s:NetrwRefresh(curislocal,s:NetrwBrowseChgDir(curislocal,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) " call Dret("s:NetrwMarkTarget") endfun @@ -6460,6 +6545,48 @@ fun! s:NetrwMarkFile(islocal,fname) endfun " --------------------------------------------------------------------- +" s:NetrwMarkFileArgList: ma: move the marked file list to the argument list (tomflist=0) {{{2 +" mA: move the argument list to marked file list (tomflist=1) +" Uses the global marked file list +fun! s:NetrwMarkFileArgList(islocal,tomflist) +" call Dfunc("s:NetrwMarkFileArgList(islocal=".a:islocal.",tomflist=".a:tomflist.")") + + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + let curdir = s:NetrwGetCurdir(a:islocal) + let curbufnr = bufnr("%") + + if a:tomflist + " mA: move argument list to marked file list + while argc() + let fname= argv(0) +" call Decho("exe argdel ".fname,'~'.expand("<slnum>")) + exe "argdel ".fnameescape(fname) + call s:NetrwMarkFile(a:islocal,fname) + endwhile + + else + " ma: move marked file list to argument list + if exists("s:netrwmarkfilelist") + + " for every filename in the marked list + for fname in s:netrwmarkfilelist +" call Decho("exe argadd ".fname,'~'.expand("<slnum>")) + exe "argadd ".fnameescape(fname) + endfor " for every file in the marked list + + " unmark list and refresh + call s:NetrwUnmarkList(curbufnr,curdir) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) + endif + endif + +" call Dret("s:NetrwMarkFileArgList") +endfun + +" --------------------------------------------------------------------- " s:NetrwMarkFileCompress: (invoked by mz) This function is used to {{{2 " compress/decompress files using the programs " in g:netrw_compress and g:netrw_uncompress, @@ -6469,7 +6596,8 @@ endfun " g:netrw_decompress = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf", ".xz" : "unxz"} fun! s:NetrwMarkFileCompress(islocal) " call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") @@ -6524,7 +6652,8 @@ fun! s:NetrwMarkFileCompress(islocal) call s:NetrwUnmarkList(curbufnr,curdir) NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) endif " call Dret("s:NetrwMarkFileCompress") endfun @@ -6541,6 +6670,12 @@ fun! s:NetrwMarkFileCopy(islocal,...) let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") + if b:netrw_curdir !~ '/$' + if !exists("b:netrw_curdir") + let b:netrw_curdir= curdir + endif + let b:netrw_curdir= b:netrw_curdir."/" + endif " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) @@ -6557,7 +6692,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) endif " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) - if a:islocal && s:netrwmftgt_islocal + if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory " call Decho("copy from local to local",'~'.expand("<slnum>")) if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^'.expand("$COMSPEC").'\s' @@ -6571,12 +6706,12 @@ fun! s:NetrwMarkFileCopy(islocal,...) if len(s:netrwmarkfilelist_{bufnr('%')}) == 1 " only one marked file " call Decho("case: only one marked file",'~'.expand("<slnum>")) - let args = s:ShellEscape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) + let args = s:ShellEscape(b:netrw_curdir.s:netrwmarkfilelist_{bufnr('%')}[0]) let oldname = s:netrwmarkfilelist_{bufnr('%')}[0] elseif a:0 == 1 " call Decho("case: handling one input argument",'~'.expand("<slnum>")) " this happens when the next case was used to recursively call s:NetrwMarkFileCopy() - let args = s:ShellEscape(b:netrw_curdir."/".a:1) + let args = s:ShellEscape(b:netrw_curdir.a:1) let oldname = a:1 else " copy multiple marked files inside the same directory @@ -6611,9 +6746,12 @@ fun! s:NetrwMarkFileCopy(islocal,...) let args= substitute(args,'/','\\','g') let tgt = substitute(tgt, '/','\\','g') endif - if args =~ "'"|let args= substitute(args,"'\\(.*\\)'",'\1','')|endif - if tgt =~ "'"|let tgt = substitute(tgt,"'\\(.*\\)'",'\1','') |endif - if args =~ '//$'|let args= substitute(args,'//$','/','')|endif + if args =~ "'" |let args= substitute(args,"'\\(.*\\)'",'\1','')|endif + if tgt =~ "'" |let tgt = substitute(tgt ,"'\\(.*\\)'",'\1','')|endif + if args =~ '//'|let args= substitute(args,'//','/','g')|endif + if tgt =~ '//'|let tgt = substitute(tgt ,'//','/','g')|endif +" call Decho("args <".args.">",'~'.expand("<slnum>")) +" call Decho("tgt <".tgt.">",'~'.expand("<slnum>")) if isdirectory(s:NetrwFile(args)) " call Decho("args<".args."> is a directory",'~'.expand("<slnum>")) let copycmd= g:netrw_localcopydircmd @@ -6688,11 +6826,17 @@ fun! s:NetrwMarkFileCopy(islocal,...) NetrwKeepj call s:NetrwDelete(fname) endfor call s:NetrwLcd(curdir) - call s:NetrwExe("sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1)) - if v:shell_error != 0 - call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) -" call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) ) - return + if v:version < 704 || !has("patch1109") + call s:NetrwExe("sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1)) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) +" " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) ) + return + endif + else + if delete(tmpdir,"d") + call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103) + endif endif else call s:NetrwLcd(curdir) @@ -6703,21 +6847,40 @@ fun! s:NetrwMarkFileCopy(islocal,...) " ------- " cleanup " ------- -" call Decho("cleanup",'~'.expand("<slnum>")) - if !exists("s:recursive") - " remove markings from local buffer - call s:NetrwUnmarkList(curbufnr,curdir) - endif - - " refresh buffers - if !s:netrwmftgt_islocal - call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) - endif - if a:islocal - NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir) +" 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>")) +" call Decho(" curdir =".curdir,'~'.expand("<slnum>")) +" call Decho(" a:islocal =".a:islocal,'~'.expand("<slnum>")) +" call Decho(" curbufnr =".curbufnr,'~'.expand("<slnum>")) + if exists("s:recursive") +" call Decho(" s:recursive =".s:recursive,'~'.expand("<slnum>")) + else +" call Decho(" s:recursive =n/a",'~'.expand("<slnum>")) endif + " see s:LocalFastBrowser() for g:netrw_fastbrowse interpretation (refreshing done for both slow and medium) if g:netrw_fastbrowse <= 1 NetrwKeepj call s:LocalBrowseRefresh() + else + " refresh local and targets for fast browsing + if !exists("s:recursive") + " remove markings from local buffer +" call Decho(" remove markings from local buffer",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwUnmarkList(curbufnr,curdir) + endif + + " refresh buffers + if s:netrwmftgt_islocal +" call Decho(" refresh s:netrwmftgt=".s:netrwmftgt,'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) + endif + if a:islocal && s:netrwmftgt != curdir +" call Decho(" refresh curdir=".curdir,'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir) + endif endif " call Dret("s:NetrwMarkFileCopy 1") @@ -6798,7 +6961,7 @@ fun! s:NetrwMarkFileEdit(islocal) endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileQFEL: convert a quickfix-error list into a marked file list {{{2 +" s:NetrwMarkFileQFEL: convert a quickfix-error or location list into a marked file list {{{2 fun! s:NetrwMarkFileQFEL(islocal,qfel) " call Dfunc("s:NetrwMarkFileQFEL(islocal=".a:islocal.",qfel)") call s:NetrwUnmarkAll() @@ -6834,7 +6997,8 @@ endfun " mX enbloc=1: Uses the global marked-file list, applies command to entire list fun! s:NetrwMarkFileExe(islocal,enbloc) " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") @@ -6894,7 +7058,8 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) " refresh the listing NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif @@ -6926,7 +7091,8 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) " refresh the listing NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) endif @@ -6939,7 +7105,8 @@ endfun " Uses the local marked file list. fun! s:NetrwMarkHideSfx(islocal) " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") " s:netrwmarkfilelist_{curbufnr}: the List of marked files @@ -6982,7 +7149,8 @@ fun! s:NetrwMarkHideSfx(islocal) " refresh the listing NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif @@ -6995,7 +7163,8 @@ endfun " Uses the local marked-file list. fun! s:NetrwMarkFileVimCmd(islocal) " call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") @@ -7039,7 +7208,8 @@ fun! s:NetrwMarkFileVimCmd(islocal) " refresh the listing NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif @@ -7053,7 +7223,8 @@ endfun " Uses the local marked file list. fun! s:NetrwMarkHideSfx(islocal) " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") " s:netrwmarkfilelist_{curbufnr}: the List of marked files @@ -7096,7 +7267,8 @@ fun! s:NetrwMarkHideSfx(islocal) " refresh the listing NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) else NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif @@ -7109,7 +7281,8 @@ endfun " Uses the global markfilelist fun! s:NetrwMarkFileGrep(islocal) " call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") let curdir = s:NetrwGetCurdir(a:islocal) @@ -7150,12 +7323,13 @@ fun! s:NetrwMarkFileGrep(islocal) echo "(use :cn, :cp to navigate, :Rex to return)" 2match none - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) 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 @@ -7353,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) @@ -7456,7 +7630,8 @@ endfun " Uses the global markfilelist fun! s:NetrwMarkFileTag(islocal) " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") @@ -7494,7 +7669,8 @@ fun! s:NetrwMarkFileTag(islocal) endif 2match none call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) endif " call Dret("s:NetrwMarkFileTag") @@ -7507,8 +7683,9 @@ endfun " s:netrwmftgt_islocal : 0=target directory is remote " 1=target directory is local fun! s:NetrwMarkFileTgt(islocal) -" call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() +" call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curdir = s:NetrwGetCurdir(a:islocal) let hadtgt = exists("s:netrwmftgt") if !exists("w:netrw_bannercnt") @@ -7526,7 +7703,8 @@ fun! s:NetrwMarkFileTgt(islocal) call s:LocalBrowseRefresh() endif call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) " call Dret("s:NetrwMarkFileTgt : removed target") return else @@ -7566,16 +7744,17 @@ 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,'./')) - if w:netrw_liststyle == s:TREELIST + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,w:netrw_treetop)) else call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) endif - call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + call winrestview(svpos) if !hadtgt sil! NetrwKeepj norm! j endif @@ -7590,7 +7769,7 @@ endfun fun! s:NetrwGetCurdir(islocal) " call Dfunc("s:NetrwGetCurdir(islocal=".a:islocal.")") - if w:netrw_liststyle == s:TREELIST + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST let b:netrw_curdir = s:NetrwTreePath(w:netrw_treetop) " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used s:NetrwTreeDir)",'~'.expand("<slnum>")) elseif !exists("b:netrw_curdir") @@ -7598,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 @@ -7626,8 +7805,8 @@ fun! s:NetrwOpenFile(islocal) endif let g:netrw_quiet = 1 " save position for benefit of Rexplore - let s:rexposn_{bufnr("%")}= netrw#SavePosn() -" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>")) + let s:rexposn_{bufnr("%")}= winsaveview() +" call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>")) if b:netrw_curdir =~ '/$' exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname) else @@ -7702,7 +7881,8 @@ fun! s:NetSortSequence(islocal) " call Dfunc("NetSortSequence(islocal=".a:islocal.")") let ykeep= @@ - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) call inputsave() let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) call inputrestore() @@ -7710,7 +7890,8 @@ fun! s:NetSortSequence(islocal) " refresh the listing let g:netrw_sort_sequence= newsortseq NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("NetSortSequence") @@ -7785,7 +7966,8 @@ endfun " s:netrwmarkfilemtch_# -- used with 2match to display marked files fun! s:NetrwUnMarkFile(islocal) " call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")") - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let curbufnr = bufnr("%") " unmark marked file list @@ -7806,7 +7988,8 @@ fun! s:NetrwUnMarkFile(islocal) 2match none " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#RestorePosn(svpos) +"call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) +call winrestview(svpos) " call Dret("s:NetrwUnMarkFile") endfun @@ -7898,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 @@ -8276,7 +8459,8 @@ fun! s:NetrwRefresh(islocal,dirname) let ykeep = @@ " save the cursor position before refresh. - let screenposn = netrw#SavePosn() + let screenposn = winsaveview() +" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) " call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">",'~'.expand("<slnum>")) " call Decho("clearing buffer prior to refresh",'~'.expand("<slnum>")) @@ -8288,7 +8472,8 @@ fun! s:NetrwRefresh(islocal,dirname) endif " restore position - NetrwKeepj call netrw#RestorePosn(screenposn) +" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(screenposn) " restore file marks if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" @@ -8439,8 +8624,8 @@ endfun " Implements [count]Tb (bookhist<b>) " [count]Th (bookhist<h>) " See :help netrw-qb for how to make the choice. -fun! s:NetrwSetTgt(bookhist,choice) -" call Dfunc("s:NetrwSetTgt(bookhist<".a:bookhist."> choice#".a:choice.")") +fun! s:NetrwSetTgt(islocal,bookhist,choice) +" call Dfunc("s:NetrwSetTgt(islocal=".a:islocal." bookhist<".a:bookhist."> choice#".a:choice.")") if a:bookhist == 'b' " supports choosing a bookmark as a target using a qb-generated list @@ -8462,6 +8647,12 @@ fun! s:NetrwSetTgt(bookhist,choice) endif endif + " refresh the display + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + call s:NetrwRefresh(a:islocal,b:netrw_curdir) + " call Dret("s:NetrwSetTgt") endfun @@ -8470,12 +8661,14 @@ endfun fun! s:NetrwSortStyle(islocal) " call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">") NetrwKeepj call s:NetrwSaveWordPosn() - let svpos= netrw#SavePosn() + 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,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) " call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">") endfun @@ -8574,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 @@ -8653,6 +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'),'~'.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 @@ -8665,12 +8860,13 @@ fun! s:NetrwTreeDir(islocal) if !exists("b:netrw_curdir") || b:netrw_curdir == "" let b:netrw_curdir= getcwd() endif - let treedir = b:netrw_curdir " call Decho("set initial treedir<".treedir.">",'~'.expand("<slnum>")) - let s:treecurpos= netrw#SavePosn() - if w:netrw_liststyle == s:TREELIST + let s:treecurpos= winsaveview() +" call Decho("saving posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>")) + + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Decho("w:netrw_liststyle is TREELIST:",'~'.expand("<slnum>")) " call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>")) @@ -8692,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 @@ -8701,13 +8897,12 @@ fun! s:NetrwTreeDir(islocal) " call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") return b:netrw_curdir " else " Decho -" call Decho(".user did not attempt to close treeroot",'~'.expand("<slnum>")) +" call Decho(".user not attempting to close treeroot",'~'.expand("<slnum>")) endif " call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("<slnum>")) -" call Decho("after subst<".substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)$','\1','').">",'~'.expand("<slnum>")) - let potentialdir= substitute(curline,'^'.s:treedepthstring.'* \(.*\)@$','\1','') -" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(s:NetrwFile(potentialdir)),'~'.expand("<slnum>")) + let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1','')) +" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("<slnum>")) " COMBAK: a symbolic link may point anywhere -- so it will be used to start a new treetop " if a:islocal && curline =~ '@$' && isdirectory(s:NetrwFile(potentialdir)) @@ -8763,9 +8958,13 @@ fun! s:NetrwTreeDisplay(dir,depth) let depth= s:treedepthstring.a:depth " call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("<slnum>")) -" call Decho("w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("<slnum>")) +" call Decho("for every entry in w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("<slnum>")) for entry in w:netrw_treedict[dir] - let direntry= substitute(dir.'/'.entry,'[@/]$','','e') + if dir =~ '/$' + let direntry= substitute(dir.entry,'[@/]$','','e') + else + let direntry= substitute(dir.'/'.entry,'[@/]$','','e') + endif " call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>")) if entry =~ '/$' && has_key(w:netrw_treedict,direntry) " call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) @@ -8786,10 +8985,48 @@ fun! s:NetrwTreeDisplay(dir,depth) endfun " --------------------------------------------------------------------- +" s:NetrwRefreshTreeDict: updates the contents information for a tree (w:netrw_treedict) {{{2 +fun! s:NetrwRefreshTreeDict(dir) +" call Dfunc("s:NetrwRefreshTreeDict(dir<".a:dir.">)") + for entry in w:netrw_treedict[a:dir] + let direntry= substitute(a:dir.'/'.entry,'[@/]$','','e') +" call Decho("a:dir<".a:dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>")) + + 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,'*',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.'/','*',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.'/','*',1) + let listdotstar= s:NetrwGlob(direntry.'/','.*',1) +" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) + + else +" call Decho('not updating w:netrw_treedict['.direntry.'] with entry<'.entry.'> (no subtree)',,'~'.expand("<slnum>")) + endif + endfor +" call Dret("s:NetrwRefreshTreeDict") +endfun + +" --------------------------------------------------------------------- " s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2 " Called by s:PerformListing() fun! s:NetrwTreeListing(dirname) - if w:netrw_liststyle == s:TREELIST + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Dfunc("NetrwTreeListing() bufname<".expand("%").">") " call Decho("curdir<".a:dirname.">",'~'.expand("<slnum>")) " call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("<slnum>")) @@ -8811,13 +9048,13 @@ fun! s:NetrwTreeListing(dirname) let w:netrw_treedict= {} endif - " update the directory listing for the current directory -" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]",'~'.expand("<slnum>")) + " update the dictionary for the current directory +" call Decho("updating: w:netrw_treedict[".a:dirname.'] -> [directory listing]','~'.expand("<slnum>")) " call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>")) - exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d' + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d _' let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$")) " call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]),'~'.expand("<slnum>")) - exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" + exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _" " if past banner, record word if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt @@ -8852,6 +9089,8 @@ endfun " wipes that out prior to calling this function fun! s:NetrwTreePath(treetop) " call Dfunc("s:NetrwTreePath() line#".line(".")."<".getline(".").">") + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') " call Decho("depth<".depth."> 1st subst",'~'.expand("<slnum>")) let depth = substitute(depth,'^'.s:treedepthstring,'','') @@ -8886,6 +9125,8 @@ fun! s:NetrwTreePath(treetop) let treedir= a:treetop.'/'.treedir endif let treedir= substitute(treedir,'//$','/','') +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))" + call winrestview(svpos) " call Dret("s:NetrwTreePath <".treedir.">") return treedir endfun @@ -8930,6 +9171,7 @@ fun! s:NetrwWideListing() " call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("<slnum>")) if has("clipboard") sil! let keepregstar = @* + sil! let keepregplus = @+ endif while line("$") >= newcolstart if newcolend > line("$") | let newcolend= line("$") | endif @@ -8940,11 +9182,12 @@ fun! s:NetrwWideListing() else exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p' endif - exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d' + exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _' exe 'sil! NetrwKeepj '.w:netrw_bannercnt endwhile if has("clipboard") sil! let @*= keepregstar + sil! let @+= keepregplus endif exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e' NetrwKeepj call histdel("/",-1) @@ -9027,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 @@ -9131,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 @@ -9150,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) @@ -9160,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 @@ -9174,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 @@ -9186,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 @@ -9205,7 +9448,7 @@ fun! s:PerformListing(islocal) " 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. " (internal#3)",'~'.expand("<slnum>")) " resolve symbolic links if local and (thin or tree) - if a:islocal && (w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:TREELIST) + if a:islocal && (w:netrw_liststyle == s:THINLIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)) " call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("<slnum>")) g/@$/call s:ShowLink() endif @@ -9247,7 +9490,8 @@ fun! s:PerformListing(islocal) if exists("s:treecurpos") " call Decho("s:treecurpos exists; restore posn",'~'.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. " (internal#8)",'~'.expand("<slnum>")) - NetrwKeepj call netrw#RestorePosn(s:treecurpos) +" call Decho("restoring posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(s:treecurpos) unlet s:treecurpos endif @@ -9310,7 +9554,7 @@ endfun " enforced here. fun! s:NetrwRemoteFtpCmd(path,listcmd) " call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) w:netrw_method=".(exists("w:netrw_method")? w:netrw_method : (exists("b:netrw_method")? b:netrw_method : "???"))) -" call Decho("line($)=".line("$")." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) +" call Decho("line($)=".line("$")." win#".winnr()." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) " sanity check: {{{3 if !exists("w:netrw_method") if exists("b:netrw_method") @@ -9329,8 +9573,8 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " clear off any older non-banner lines " {{{3 " note that w:netrw_bannercnt indexes the line after the banner -" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d (clear off old non-banner lines)",'~'.expand("<slnum>")) - exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" +" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d _ (clear off old non-banner lines)",'~'.expand("<slnum>")) + exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _" "......................................... if w:netrw_method == 2 || w:netrw_method == 5 " {{{3 @@ -9427,7 +9671,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) sil! NetrwKeepj g/l\%([-r][-w][-x]\)\{3}/NetrwKeepj s/$/@/e NetrwKeepj call histdel("/",-1) NetrwKeepj call histdel("/",-1) - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST) exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' NetrwKeepj call histdel("/",-1) endif @@ -9451,7 +9695,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwRemoteListing: {{{2 fun! s:NetrwRemoteListing() -" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">)") +" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">) win#".winnr()) if !exists("w:netrw_bannercnt") && exists("s:bannercnt") let w:netrw_bannercnt= s:bannercnt @@ -9501,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>")) @@ -9515,7 +9759,7 @@ fun! s:NetrwRemoteListing() let mesg= getline(".") if exists("w:netrw_bannercnt") setl ma - exe w:netrw_bannercnt.",$d" + exe w:netrw_bannercnt.",$d _" setl noma endif NetrwKeepj call s:NetrwOptionRestore("w:") @@ -9524,7 +9768,7 @@ fun! s:NetrwRemoteListing() return -1 endif - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST) " shorten the listing " call Decho("generate short listing",'~'.expand("<slnum>")) exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt @@ -9610,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 @@ -9654,7 +9898,8 @@ endfun fun! s:NetrwRemoteRm(usrhost,path) range " call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol(".")) " call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>")) - let svpos= netrw#SavePosn() + let svpos= winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let all= 0 if exists("s:netrwmarkfilelist_{bufnr('%')}") @@ -9662,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 @@ -9683,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 @@ -9696,7 +9941,8 @@ fun! s:NetrwRemoteRm(usrhost,path) range " refresh the (remote) directory listing " call Decho("refresh remote directory listing",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) " call Dret("s:NetrwRemoteRm") endfun @@ -9723,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>")) @@ -9736,7 +9982,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) if path =~ '^\a\{3,}://' let path= substitute(path,'^\a\{3,}://[^/]\+/','','') endif - sil! NetrwKeepj .,$d + sil! NetrwKeepj .,$d _ call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"') else " call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">",'~'.expand("<slnum>")) @@ -9763,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 @@ -9784,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 @@ -9812,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 @@ -9827,7 +10073,8 @@ fun! s:NetrwRemoteRename(usrhost,path) range " call Dfunc("NetrwRemoteRename(usrhost<".a:usrhost."> path<".a:path.">)") " preparation for removing multiple files/directories - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) let ctr = a:firstline let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd) @@ -9893,7 +10140,8 @@ fun! s:NetrwRemoteRename(usrhost,path) range " refresh the directory NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) " call Dret("NetrwRemoteRename") endfun @@ -9955,7 +10203,7 @@ endfun " --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) - " This function is called by netrwPlugin.vim's s:LocalBrowse() and by s:NetrwRexplore() + " This function is called by netrwPlugin.vim's s:LocalBrowse(), s:NetrwRexplore(), and by <cr> when atop listed file/directory " unfortunate interaction -- split window debugging can't be " used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter " event triggers another call to LocalBrowseCheck() when attempts @@ -9964,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>")) @@ -9988,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 @@ -10068,12 +10315,15 @@ 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 endif " call Decho("#3: quickhelp=".g:netrw_quickhelp,'~'.expand("<slnum>")) + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop) + endif NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) endif let ibl= ibl + 1 @@ -10171,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")) @@ -10191,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")') @@ -10263,12 +10506,15 @@ fun! s:LocalListing() if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) + 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) @@ -10281,6 +10527,9 @@ 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]" + let sz= s:NetrwHumanReadable(sz) + endif let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz " call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'",'~'.expand("<slnum>")) let fszpfile= fsz.'/'.pfile @@ -10339,7 +10588,8 @@ fun! s:NetrwLocalRename(path) range " preparation for removing multiple files/directories let ykeep = @@ let ctr = a:firstline - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) " rename files given by the markfilelist if exists("s:netrwmarkfilelist_{bufnr('%')}") @@ -10405,7 +10655,8 @@ fun! s:NetrwLocalRename(path) range " refresh the directory " call Decho("refresh the directory listing",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) let @@= ykeep " call Dret("NetrwLocalRename") @@ -10421,16 +10672,17 @@ fun! s:NetrwLocalRm(path) range let ykeep = @@ let ret = 0 let all = 0 - let svpos = netrw#SavePosn() + let svpos = winsaveview() +" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files " 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 @@ -10457,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 @@ -10471,7 +10723,8 @@ fun! s:NetrwLocalRm(path) range " call Decho("bufname<".bufname("%").">",'~'.expand("<slnum>")) if bufname("%") != "NetrwMessage" NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) +" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(svpos) endif let @@= ykeep @@ -10505,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 @@ -10526,35 +10779,41 @@ 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 == "" -" 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)) -" call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>")) + 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)) +" " call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>")) - if v:shell_error != 0 -" call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) - let errcode= s:NetrwDelete(rmfile) -" call Decho("errcode=".errcode,'~'.expand("<slnum>")) - - if errcode != 0 - if has("unix") -" call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) - call system("rm ".s:ShellEscape(rmfile)) - if v:shell_error != 0 && !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) + if v:shell_error != 0 +" " call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) + let errcode= s:NetrwDelete(rmfile) +" " call Decho("errcode=".errcode,'~'.expand("<slnum>")) + + if errcode != 0 + if has("unix") +" " call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) + call system("rm ".s:ShellEscape(rmfile)) + if v:shell_error != 0 && !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) + let ok="no" + endif + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35) let ok="no" endif - elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35) - let ok="no" endif endif + else + if delete(rmfile,"d") + call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103) + endif endif endif endif @@ -10567,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 @@ -10593,83 +10863,6 @@ fun! netrw#Call(funcname,...) " call Dret("netrw#Call") endfun -" ------------------------------------------------------------------------ -" netrw#RestorePosn: restores the cursor and file position as saved by netrw#SavePosn() {{{2 -fun! netrw#RestorePosn(...) -" call Dfunc("netrw#RestorePosn() a:0=".a:0." winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : -1)." line=".(exists("w:netrw_line")? w:netrw_line : -1)." col=".(exists("w:netrw_col")? w:netrw_col : -1)." hline=".(exists("w:netrw_hline")? w:netrw_hline : -1)) - let eikeep= &ei - setl ei=all - if expand("%") == "NetrwMessage" - if exists("s:winBeforeErr") - exe s:winBeforeErr."wincmd w" - endif - endif - - if a:0 > 0 - exe "keepj ".a:1 - endif -" "call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a'),'~'.expand("<slnum>")) -" "call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) - if exists("liststyle") && exists("w:netrw_liststyle") && liststyle != w:netrw_liststyle - let usesrch= 1 - else - let usesrch= 0 - endif - -" "call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1),'~'.expand("<slnum>")) -" "call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1),'~'.expand("<slnum>")) -" "call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0),'~'.expand("<slnum>")) -" "call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a'),'~'.expand("<slnum>")) - - " restore window - if exists("w:netrw_winnr") -" "call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w",'~'.expand("<slnum>")) - exe "sil! ".w:netrw_winnr."wincmd w" - endif -" if v:shell_error == 0 - " as suggested by Bram M: redraw on no error - " allows protocol error messages to remain visible -" redraw! -" endif - - " restore top-of-screen line - if exists("w:netrw_hline") -" "call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z",'~'.expand("<slnum>")) - exe "keepj norm! ".w:netrw_hline."G0z\<CR>" - endif - - " restore position - " when the window's height x width has changed, the line,col is no longer useful - if w:netrw_winh == winheight(0) && w:netrw_winw == winwidth(0) && exists("w:netrw_line") && exists("w:netrw_col") && !usesrch -" "call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|",'~'.expand("<slnum>")) - exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\<bar>" - - elseif exists("w:netrw_winfile") - if !search('\<'.escape(w:netrw_winfile,g:netrw_fname_escape),'cw') - if exists("w:netrw_bannercnt") -" "call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>")) - exe "keepj ".w:netrw_bannercnt - norm! 0 - else - " go to upper left corner -" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>")) - keepj 1 - norm! 0 - endif - else -" "call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>")) - endif - - else -" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0),'~'.expand("<slnum>")) - keepj 1 - norm! 0 - endif - - let &ei= eikeep -" call Dret("netrw#RestorePosn : line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) -endfun - " --------------------------------------------------------------------- " netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2 " I expect this function to be used in @@ -10677,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)) @@ -10713,48 +10910,6 @@ fun! netrw#RFC2396(fname) endfun " --------------------------------------------------------------------- -" netrw#SavePosn: saves position of cursor on screen {{{2 -fun! netrw#SavePosn() -" call Dfunc("netrw#SavePosn() win#".winnr()." line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) - " Save current line and column - let w:netrw_winnr= winnr() - let w:netrw_line = line(".") - let w:netrw_col = virtcol(".") -" "call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col,'~'.expand("<slnum>")) - - " save filename under cursor -" "call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("<slnum>")) - if exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt && &ft == "netrw" - let winfile = "|let w:netrw_winfile=\"".fnameescape(s:NetrwGetWord())."\"" - else - let winfile= "" - endif -" "call Decho("winfile<".winfile.">",'~'.expand("<slnum>")) - if exists("w:netrw_liststyle") - let liststyle = "|let liststyle=".w:netrw_liststyle - else - let liststyle= "" - endif -" "call Decho("liststyle=".liststyle,'~'.expand("<slnum>")) - - " Save top-of-screen line - keepj norm! H0 - let w:netrw_hline= line(".") - - " save up alternate position information - " use this when window height x width has changed - let w:netrw_winh = winheight(0) - let w:netrw_winw = winwidth(0) - - " set up string holding position parameters - let ret = "let w:netrw_winnr=".w:netrw_winnr."|let w:netrw_line=".w:netrw_line."|let w:netrw_col=".w:netrw_col."|let w:netrw_hline=".w:netrw_hline."|let w:netrw_winh=".w:netrw_winh."|let w:netrw_winw=".w:netrw_winw.liststyle.winfile - - keepj call netrw#RestorePosn() -" call Dret("netrw#SavePosn : win#=".(exists("w:netrw_winnr")? w:netrw_winnr : "n/a")." line=".(exists("w:netrw_line")? w:netrw_line : "n/a")." col=".(exists("w:netrw_col")? w:netrw_col : "n/a")." hline=".(exists("w:netrw_hline")? w:netrw_hline : "n/a")) - return ret -endfun - -" --------------------------------------------------------------------- " netrw#UserMaps: supports user-specified maps {{{2 " see :help function() " @@ -10823,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")) @@ -11053,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 @@ -11198,10 +11353,14 @@ fun! s:NetrwEnew(...) NetrwKeepj call s:NetrwOptionRestore("w:") " 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. + " 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 @@ -11227,8 +11386,9 @@ fun! s:NetrwEnew(...) let b:netrw_curdir= a:1 if b:netrw_curdir =~ '/$' if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + setl nobl file NetrwTreeListing - setl bt=nowrite noswf bh=hide + setl nobl bt=nowrite bh=hide nno <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> nno <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> else @@ -11259,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 @@ -11280,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 " --------------------------------------------------------------------- @@ -11331,6 +11491,50 @@ fun! s:NetrwSaveWordPosn() endfun " --------------------------------------------------------------------- +" s:NetrwHumanReadable: takes a number and makes it "human readable" {{{2 +" 1000 -> 1K, 1000000 -> 1M, 1000000000 -> 1G +fun! s:NetrwHumanReadable(sz) +" call Dfunc("s:NetrwHumanReadable(sz=".a:sz.") type=".type(a:sz)." style=".g:netrw_sizestyle ) + + if g:netrw_sizestyle == 'h' + if a:sz >= 1000000000 + let sz = printf("%.1f",a:sz/1000000000.0)."g" + elseif a:sz >= 10000000 + let sz = printf("%d",a:sz/1000000)."m" + elseif a:sz >= 1000000 + let sz = printf("%.1f",a:sz/1000000.0)."m" + elseif a:sz >= 10000 + let sz = printf("%d",a:sz/1000)."k" + elseif a:sz >= 1000 + let sz = printf("%.1f",a:sz/1000.0)."k" + else + let sz= a:sz + endif + + elseif g:netrw_sizestyle == 'H' + if a:sz >= 1073741824 + let sz = printf("%.1f",a:sz/1073741824.0)."G" + elseif a:sz >= 10485760 + let sz = printf("%d",a:sz/1048576)."M" + elseif a:sz >= 1048576 + let sz = printf("%.1f",a:sz/1048576.0)."M" + elseif a:sz >= 10240 + let sz = printf("%d",a:sz/1024)."K" + elseif a:sz >= 1024 + let sz = printf("%.1f",a:sz/1024.0)."K" + else + let sz= a:sz + endif + + else + let sz= a:sz + endif + +" call Dret("s:NetrwHumanReadable ".sz) + return sz +endfun + +" --------------------------------------------------------------------- " s:NetrwRestoreWordPosn: used to keep cursor on same word after refresh, {{{2 " changed sorting, etc. Also see s:NetrwSaveWordPosn(). fun! s:NetrwRestoreWordPosn() @@ -11442,14 +11646,14 @@ 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) if exists("s:netrwdrag") return endif -" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir.">") +" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir."> win#".winnr()) " call Decho("currently in bufname<".bufname("%").">",'~'.expand("<slnum>")) " call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>")) @@ -11474,7 +11678,7 @@ fun! s:NetrwRexplore(islocal,dirname) " call Decho("set w:netrw_rexfile<".w:netrw_rexfile."> (win#".winnr().")",'~'.expand("<slnum>")) if !exists("w:netrw_rexlocal") -" call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft.")") +" call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft." win#".winnr().")") return endif " 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>")) @@ -11489,7 +11693,8 @@ fun! s:NetrwRexplore(islocal,dirname) if exists("s:rexposn_".bufnr("%")) " call Decho("restore posn, then unlet s:rexposn_".bufnr('%')."<".bufname("%").">",'~'.expand("<slnum>")) " restore position in directory listing - NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) +" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>")) + NetrwKeepj call winrestview(s:rexposn_{bufnr('%')}) if exists("s:rexposn_".bufnr('%')) unlet s:rexposn_{bufnr('%')} endif @@ -11522,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()) @@ -11571,11 +11799,14 @@ endfun " --------------------------------------------------------------------- " s:SetRexDir: set directory for :Rexplore {{{2 fun! s:SetRexDir(islocal,dirname) -" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)") +" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">) win#".winnr()) let w:netrw_rexdir = a:dirname let w:netrw_rexlocal = a:islocal - let s:rexposn_{bufnr("%")} = netrw#SavePosn() -" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>")) + let s:rexposn_{bufnr("%")} = winsaveview() +" 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 ".string(winsaveview()),'~'.expand("<slnum>")) " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun @@ -11685,56 +11916,39 @@ fun! s:ShellEscape(s, ...) endfun " --------------------------------------------------------------------- -" s:TreeListMove: {{{2 +" s:TreeListMove: supports [[, ]], [], and ][ in tree mode {{{2 fun! s:TreeListMove(dir) " call Dfunc("s:TreeListMove(dir<".a:dir.">)") - let curline = getline('.') - let prvline = (line(".") > 1)? getline(line(".")-1) : '' - let nxtline = (line(".") < line("$"))? getline(line(".")+1) : '' - let curindent= substitute(curline,'^\([| ]*\).\{-}$','\1','') - let indentm1 = substitute(curindent,'^'.s:treedepthstring.' ','','') -" call Decho("prvline <".prvline."> #".line(".")-1,'~'.expand("<slnum>")) -" call Decho("curline <".curline."> #".line("."),'~'.expand("<slnum>")) -" call Decho("nxtline <".nxtline."> #".line(".")+1,'~'.expand("<slnum>")) -" call Decho("curindent<".curindent.">",'~'.expand("<slnum>")) -" call Decho("indentm1 <".indentm1.">",'~'.expand("<slnum>")) - + let curline = getline('.') + let prvline = (line(".") > 1)? getline(line(".")-1) : '' + let nxtline = (line(".") < line("$"))? getline(line(".")+1) : '' + let curindent = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') + let indentm1 = substitute(curindent,'^'.s:treedepthstring,'','') + let treedepthchr = substitute(s:treedepthstring,' ','','g') + let stopline = exists("w:netrw_bannercnt")? w:netrw_bannercnt : 1 +" call Decho("prvline <".prvline."> #".(line(".")-1), '~'.expand("<slnum>")) +" call Decho("curline <".curline."> #".line(".") , '~'.expand("<slnum>")) +" call Decho("nxtline <".nxtline."> #".(line(".")+1), '~'.expand("<slnum>")) +" call Decho("curindent<".curindent.">" , '~'.expand("<slnum>")) +" call Decho("indentm1 <".indentm1.">" , '~'.expand("<slnum>")) + " COMBAK : need to handle when on a directory + " COMBAK : need to handle ]] and ][. In general, needs work!!! if curline !~ '/$' -" call Decho('regfile','~'.expand("<slnum>")) - if a:dir == '[' && prvline != '' + if a:dir == '[[' && prvline != '' NetrwKeepj norm! 0 - let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from regular file + let nl = search('^'.indentm1.'\%('.s:treedepthstring.'\)\@!','bWe',stopline) " search backwards " call Decho("regfile srch back: ".nl,'~'.expand("<slnum>")) - elseif a:dir == ']' && nxtline != '' - NetrwKeepj norm! $ - let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from regular file -" call Decho("regfile srch fwd: ".nl,'~'.expand("<slnum>")) - endif - - elseif a:dir == '[' && prvline != '' - NetrwKeepj norm! 0 - let curline= line(".") - let nl = search('^'.curindent.'[^'.s:treedepthstring.']','bWe') " search backwards From directory, same indentation -" call Decho("dir srch back ind: ".nl,'~'.expand("<slnum>")) - if nl != 0 - if line(".") == curline-1 - let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from directory, indentation - 1 -" call Decho("dir srch back ind-1: ".nl,'~'.expand("<slnum>")) - endif - endif - - elseif a:dir == ']' && nxtline != '' - NetrwKeepj norm! $ - let curline = line(".") - let nl = search('^'.curindent.'[^'.s:treedepthstring.']','We') " search forwards from directory, same indentation -" call Decho("dir srch fwd ind: ".nl,'~'.expand("<slnum>")) - if nl != 0 - if line(".") == curline+1 - let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from directory, indentation - 1 -" call Decho("dir srch fwd ind-1: ".nl,'~'.expand("<slnum>")) + elseif a:dir == '[]' && nxtline != '' + NetrwKeepj norm! 0 +" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>','~'.expand("<slnum>")) + let nl = search('^\%('.curindent.'\)\@!','We') " search forwards + if nl != 0 + NetrwKeepj norm! k + else + NetrwKeepj norm! G endif +" call Decho("regfile srch fwd: ".nl,'~'.expand("<slnum>")) endif - endif " call Dret("s:TreeListMove") diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index c7cb14ded7..1bcc1dea74 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -22,54 +22,85 @@ function! s:try_cmd(cmd, ...) let argv = split(a:cmd, " ") let out = a:0 ? systemlist(argv, a:1, 1) : systemlist(argv, [''], 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] : '') + 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) + 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 nvim-clipboard' +let s:err = '' + +function! provider#clipboard#Error() abort + return s:err +endfunction + +function! provider#clipboard#Executable() abort + if has('mac') && 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 + return 'pbcopy' + 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 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 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') + let s:copy['+'] = 'win32yank -i --crlf' + let s:paste['+'] = 'win32yank -o --lf' + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] + return 'win32yank' + endif + + let s:err = 'clipboard: No clipboard tool available. See :help clipboard' + return '' +endfunction + +if empty(provider#clipboard#Executable()) 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 + if 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) @@ -94,6 +125,7 @@ function! s:clipboard.set(lines, regtype, reg) let selection.data = [a:lines, a:regtype] let argv = split(s:copy[a:reg], " ") let selection.detach = s:cache_enabled + let selection.cwd = "/" let jobid = jobstart(argv, selection) if jobid <= 0 echohl WarningMsg diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim index cb9d5c5296..b99a046375 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 nvim-provider" for more information. +" python-vim plugins. See ":help provider". " " Associating the plugin with the Python host is the first step because plugins " will be passed as command-line arguments diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim index f4a751e7a2..4f47a03a9b 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 nvim-provider" for more information. +" python3 plugins. See ":help provider". " " Associating the plugin with the Python3 host is the first step because " plugins will be passed as command-line arguments diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 05815a4896..08a0f39b01 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -5,11 +5,24 @@ endif let s:loaded_pythonx_provider = 1 +let s:stderr = {} +let s:job_opts = {'rpc': v:true} + +" TODO(bfredl): this logic is common and should be builtin +function! s:job_opts.on_stderr(chan_id, data, event) + let stderr = get(s:stderr, a:chan_id, ['']) + let last = remove(stderr, -1) + let a:data[0] = last.a:data[0] + call extend(stderr, a:data) + let s:stderr[a:chan_id] = stderr +endfunction + function! provider#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) @@ -18,46 +31,44 @@ function! provider#pythonx#Require(host) abort endfor try - let channel_id = rpcstart((ver == '2' ? - \ provider#python#Prog() : provider#python3#Prog()), args) - if rpcrequest(channel_id, 'poll') == 'ok' + let channel_id = jobstart(args, s:job_opts) + if rpcrequest(channel_id, 'poll') ==# 'ok' return channel_id endif catch echomsg v:throwpoint echomsg v:exception + for row in get(s:stderr, channel_id, []) + echomsg row + endfor endtry throw remote#host#LoadErrorForHost(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] + if a:major_ver == 2 + if exists('g:python_host_prog') + return [g:python_host_prog, ''] + else + let progs = ['python2', 'python2.7', 'python2.6', 'python'] + endif + else + if exists('g:python3_host_prog') + return [g:python3_host_prog, ''] + else + let progs = ['python3', 'python3.7', 'python3.6', 'python3.5', + \ 'python3.4', 'python3.3', 'python'] endif - return ['', 'provider/pythonx: Could not load Python ' . a:major_ver - \ . ' from ' . host_var . ': ' . err] endif - let prog_suffixes = (a:major_ver == 2) ? - \ ['2', '2.7', '2.6', ''] - \ : ['3', '3.5', '3.4', '3.3', ''] - let errors = [] - for prog in map(prog_suffixes, "'python' . v:val") - let [result, err] = s:check_interpreter(prog, a:major_ver, skip) + + for prog in progs + let [result, err] = s:check_interpreter(prog, a:major_ver) if result return [prog, err] endif - " Accumulate errors in case we don't find " any suitable Python interpreter. call add(errors, err) @@ -68,23 +79,19 @@ function! provider#pythonx#Detect(major_ver) abort \ . ":\n" . join(errors, "\n")] endfunction -function! s:check_interpreter(prog, major_ver, skip) abort +function! s:check_interpreter(prog, major_ver) abort let prog_path = exepath(a:prog) - if prog_path == '' + 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' " Try to load neovim module, and output Python version. " Return codes: " 0 Neovim module can be loaded. - " 1 Something else went wrong. " 2 Neovim 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(""); ' . @@ -93,7 +100,8 @@ function! s:check_interpreter(prog, major_ver, skip) abort \ 'exit(2*int(pkgutil.get_loader("neovim") is None))' \ ]) - if prog_ver + if v:shell_error == 2 || v:shell_error == 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 . '.'] @@ -103,12 +111,16 @@ function! s:check_interpreter(prog, major_ver, skip) abort endif endif - if v:shell_error == 1 + 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 + " This can happen with pyenv's shims. + return [0, prog_path . ' does not exist: ' . prog_ver] + elseif v:shell_error return [0, 'Checking ' . prog_path . ' caused an unknown error. ' - \ . 'Please report this at github.com/neovim/neovim.'] - elseif v:shell_error == 2 - return [0, prog_path . ' does have not have the neovim module installed. ' - \ . 'See ":help nvim-python".'] + \ . '(' . v:shell_error . ', output: ' . prog_ver . ')' + \ . ' Please report this at github.com/neovim/neovim.'] endif return [1, ''] diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim index aad8c09d28..c8ede20a75 100644 --- a/runtime/autoload/provider/ruby.vim +++ b/runtime/autoload/provider/ruby.vim @@ -1,13 +1,30 @@ " 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 +let s:stderr = {} +let s:job_opts = {'rpc': v:true} + +function! s:job_opts.on_stderr(chan_id, data, event) + let stderr = get(s:stderr, a:chan_id, ['']) + let last = remove(stderr, -1) + let a:data[0] = last.a:data[0] + call extend(stderr, a:data) + let s:stderr[a:chan_id] = stderr +endfunction + +function! provider#ruby#Detect() abort + return exepath('neovim-ruby-host') +endfunction + +function! provider#ruby#Prog() + return s:prog +endfunction function! provider#ruby#Require(host) abort - " Collect registered Ruby plugins into args - let args = [] + let args = [provider#ruby#Prog()] let ruby_plugins = remote#host#PluginsForHost(a:host.name) for plugin in ruby_plugins @@ -15,20 +32,47 @@ function! provider#ruby#Require(host) abort endfor try - let channel_id = rpcstart(provider#ruby#Prog(), args) - - if rpcrequest(channel_id, 'poll') == 'ok' + let channel_id = jobstart(args, s:job_opts) + if rpcrequest(channel_id, 'poll') ==# 'ok' return channel_id endif catch echomsg v:throwpoint echomsg v:exception + for row in get(s:stderr, channel_id, []) + echomsg row + endfor endtry - - throw remote#host#LoadErrorForHost(a:host.orig_name, - \ '$NVIM_RUBY_LOG_FILE') + throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_RUBY_LOG_FILE') endfunction -function! provider#ruby#Prog() abort - return 'neovim-ruby-host' +function! provider#ruby#Call(method, args) + if s:err != '' + echoerr s:err + return + endif + + 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 + +let s:err = '' +let s:prog = provider#ruby#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..1dade766c7 --- /dev/null +++ b/runtime/autoload/provider/script_host.rb @@ -0,0 +1,8 @@ +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/host.vim b/runtime/autoload/remote/host.vim index a63c6a923b..51f7e5886f 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -1,7 +1,5 @@ let s:hosts = {} let s:plugin_patterns = {} -let s:remote_plugins_manifest = fnamemodify(expand($MYVIMRC, 1), ':h') - \.'/.'.fnamemodify($MYVIMRC, ':t').'-rplugin~' let s:plugins_for_host = {} @@ -120,9 +118,59 @@ function! remote#host#RegisterPlugin(host, path, specs) abort endfunction +" Get the path to the rplugin manifest file. +function! s:GetManifestPath() abort + let manifest_base = '' + + if exists('$NVIM_RPLUGIN_MANIFEST') + return fnamemodify($NVIM_RPLUGIN_MANIFEST, ':p') + endif + + let dest = has('win32') ? '$LOCALAPPDATA' : '$XDG_DATA_HOME' + if !exists(dest) + let dest = has('win32') ? '~/AppData/Local' : '~/.local/share' + endif + + let dest = fnamemodify(expand(dest), ':p') + if !empty(dest) && !filereadable(dest) + let dest .= ('/' ==# dest[-1:] ? '' : '/') . 'nvim' + call mkdir(dest, 'p', 0700) + let manifest_base = dest + endif + + return manifest_base.'/rplugin.vim' +endfunction + + +" Old manifest file based on known script locations. +function! s:GetOldManifestPath() abort + let prefix = exists('$MYVIMRC') + \ ? $MYVIMRC + \ : matchstr(get(split(execute('scriptnames'), '\n'), 0, ''), '\f\+$') + return fnamemodify(expand(prefix, 1), ':h') + \.'/.'.fnamemodify(prefix, ':t').'-rplugin~' +endfunction + + +function! s:GetManifest() abort + let manifest = s:GetManifestPath() + + if !filereadable(manifest) + " Check if an old manifest file exists and move it to the new location. + let old_manifest = s:GetOldManifestPath() + if filereadable(old_manifest) + call rename(old_manifest, manifest) + endif + endif + + return manifest +endfunction + + function! remote#host#LoadRemotePlugins() abort - if filereadable(s:remote_plugins_manifest) - exe 'source '.s:remote_plugins_manifest + let manifest = s:GetManifest() + if filereadable(manifest) + execute 'source' fnameescape(manifest) endif endfunction @@ -130,7 +178,9 @@ endfunction function! remote#host#LoadRemotePluginsEvent(event, pattern) abort autocmd! nvim-rplugin call remote#host#LoadRemotePlugins() - execute 'silent doautocmd <nomodeline>' a:event a:pattern + if exists('#'.a:event.'#'.a:pattern) " Avoid 'No matching autocommands'. + execute 'silent doautocmd <nomodeline>' a:event a:pattern + endif endfunction @@ -140,7 +190,8 @@ function! s:RegistrationCommands(host) abort 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 = map(paths, 'tr(resolve(v:val),"\\","/")') " Normalize slashes #4795 + let paths = uniq(sort(paths)) if empty(paths) return [] endif @@ -194,9 +245,9 @@ function! remote#host#UpdateRemotePlugins() abort endtry endif endfor - call writefile(commands, s:remote_plugins_manifest) - echomsg printf('remote/host: generated the manifest file in "%s"', - \ s:remote_plugins_manifest) + call writefile(commands, s:GetManifest()) + echomsg printf('remote/host: generated rplugin manifest: %s', + \ s:GetManifest()) endfunction @@ -210,12 +261,9 @@ 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 diff --git a/runtime/autoload/shada.vim b/runtime/autoload/shada.vim index 9be85b6f2e..cf27ee608a 100644 --- a/runtime/autoload/shada.vim +++ b/runtime/autoload/shada.vim @@ -241,8 +241,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 +357,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/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim index 4a8863e15f..e80729add4 100644 --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -1,8 +1,8 @@ " Vim OMNI completion script for SQL " Language: SQL " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> -" Version: 15.0 -" Last Change: 2013 May 13 +" Version: 16.0 +" Last Change: 2015 Dec 29 " Homepage: http://www.vim.org/scripts/script.php?script_id=1572 " Usage: For detailed help " ":help sql.txt" @@ -16,6 +16,12 @@ " look backwards to a FROM clause and find the first table " and complete it. " +" Version 16.0 (Dec 2015) +" - NF: If reseting the cache and table, procedure or view completion +" had been used via dbext, have dbext delete or recreate the +" dictionary so that new objects are picked up for the +" next completion. +" " Version 15.0 (May 2013) " - NF: Changed the SQL precached syntax items, omni_sql_precache_syntax_groups, " to use regular expressions to pick up extended syntax group names. @@ -103,7 +109,7 @@ endif if exists('g:loaded_sql_completion') finish endif -let g:loaded_sql_completion = 150 +let g:loaded_sql_completion = 160 let s:keepcpo= &cpo set cpo&vim @@ -459,6 +465,29 @@ function! sqlcomplete#Complete(findstart, base) let s:tbl_cols = [] let s:syn_list = [] let s:syn_value = [] + + if s:sql_file_table != "" + if g:loaded_dbext >= 2300 + call DB_DictionaryDelete("table") + else + DBCompleteTables! + endif + endif + if s:sql_file_procedure != "" + if g:loaded_dbext >= 2300 + call DB_DictionaryDelete("procedure") + else + DBCompleteProcedures! + endif + endif + if s:sql_file_view != "" + if g:loaded_dbext >= 2300 + call DB_DictionaryDelete("view") + else + DBCompleteViews! + endif + endif + let s:sql_file_table = "" let s:sql_file_procedure = "" let s:sql_file_view = "" 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/compiler/gcc.vim b/runtime/compiler/gcc.vim index aee31d92c2..19ea2edc12 100644 --- a/runtime/compiler/gcc.vim +++ b/runtime/compiler/gcc.vim @@ -2,6 +2,7 @@ " Compiler: GNU C Compiler " Maintainer: Nikolai Weibull <now@bitwi.se> " Latest Revision: 2010-10-14 +" added line suggested by Anton Lindqvist 2016 Mar 31 if exists("current_compiler") finish @@ -24,6 +25,7 @@ CompilerSet errorformat= \%f:%l:\ %trror:\ %m, \%f:%l:\ %tarning:\ %m, \%f:%l:\ %m, + \%f:\\(%*[^\\)]\\):\ %m, \\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m, \%D%*\\a[%*\\d]:\ Entering\ directory\ [`']%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ [`']%f', diff --git a/runtime/compiler/tidy.vim b/runtime/compiler/tidy.vim index 56baee2224..75be8b83d9 100644 --- a/runtime/compiler/tidy.vim +++ b/runtime/compiler/tidy.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: HTML Tidy " Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2013 Jul 7 +" Last Change: 2016 Apr 21 if exists("current_compiler") finish @@ -12,8 +12,8 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal <args> endif -CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ % +CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ %:S -" sample warning: foo.html:8:1: Warning: inserting missing 'foobar' element -" sample error: foo.html:9:2: Error: <foobar> is not recognized! -CompilerSet errorformat=%f:%l:%c:\ Error:%m,%f:%l:%c:\ Warning:%m,%-G%.%# +" foo.html:8:1: Warning: inserting missing 'foobar' element +" foo.html:9:2: Error: <foobar> is not recognized! +CompilerSet errorformat=%f:%l:%c:\ %trror:%m,%f:%l:%c:\ %tarning:%m,%-G%.%# diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile index 7423e63673..dabbcd08d9 100644 --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -6,32 +6,14 @@ AWK = awk -# Set to $(VIMTARGET) when executed from src/Makefile. -VIMEXE = vim - DOCS = $(wildcard *.txt) HTMLS = $(DOCS:.txt=.html) .SUFFIXES: .SUFFIXES: .c .o .txt .html -all: tags html - -# Use Vim to generate the tags file. Can only be used when Vim has been -# compiled and installed. Supports multiple languages. -vimtags: $(DOCS) - $(VIMEXE) -u NONE -es -c "helptags ++t ." -c quit - -# Use "doctags" to generate the tags file. Only works for English! -tags: doctags $(DOCS) - ./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags - uniq -d -2 tags - -doctags: doctags.c - $(CC) doctags.c -o doctags - # Awk version of .txt to .html conversion. -html: noerrors tags $(HTMLS) +html: noerrors $(HTMLS) @if test -f errors.log; then cat errors.log; fi noerrors: @@ -54,5 +36,5 @@ tags.ref tags.html: tags $(AWK) -f maketags.awk tags >tags.html clean: - -rm -f doctags *.html tags.ref $(HTMLS) errors.log + -rm -f *.html tags.ref $(HTMLS) errors.log tags diff --git a/runtime/doc/api-funcs.txt b/runtime/doc/api-funcs.txt new file mode 100644 index 0000000000..706941fd12 --- /dev/null +++ b/runtime/doc/api-funcs.txt @@ -0,0 +1,716 @@ +*api-funcs.txt* Neovim API Function Reference {Nvim} + +Note: This documentation is generated from Neovim's API source code. + +Contents: + +1. Global Functions |api-global| +2. Buffer Functions |api-buffer| +3. Window Functions |api-window| +4. Tabpage Functions |api-tabpage| +5. UI Functions |api-ui| + +============================================================================== +1. Global Functions *api-global* + +nvim_command({command}) *nvim_command()* + Executes an ex-command. On VimL error: Returns the VimL error; + v:errmsg is not updated. + + Parameters:~ + {command} Ex-command string + +nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()* + Passes input keys to Nvim. On VimL error: Does not fail, but + updates v:errmsg. + + Parameters:~ + {keys} to be typed + {mode} mapping options + {escape_csi} If true, escape K_SPECIAL/CSI bytes in + `keys` + +nvim_input({keys}) *nvim_input()* + Passes keys to Nvim as raw user-input. On VimL error: Does not + fail, but updates v:errmsg. + + Unlike `nvim_feedkeys`, this uses a lower-level input buffer + and the call is not deferred. This is the most reliable way to + emulate real user input. + + Parameters:~ + {keys} to be typed + + Return:~ + Number of bytes actually written (can be fewer than + requested if the buffer becomes full). + + *nvim_replace_termcodes()* +nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special}) + Replaces any terminal codes with the internal representation + +nvim_command_output({str}) *nvim_command_output()* + TODO: Documentation + +nvim_eval({expr}) *nvim_eval()* + Evaluates a VimL expression (:help expression). Dictionaries + and Lists are recursively expanded. On VimL error: Returns a + generic error; v:errmsg is not updated. + + Parameters:~ + {expr} VimL expression string + + Return:~ + Evaluation result or expanded object + +nvim_call_function({fname}, {args}) *nvim_call_function()* + Calls a VimL function with the given arguments. On VimL error: + Returns a generic error; v:errmsg is not updated. + + Parameters:~ + {fname} Function to call + {args} Function arguments packed in an Array + + Return:~ + Result of the function call + +nvim_strwidth({str}) *nvim_strwidth()* + Calculates the number of display cells occupied by `text`. + <Tab> counts as one cell. + + Parameters:~ + {text} Some text + + Return:~ + Number of cells + +nvim_list_runtime_paths() *nvim_list_runtime_paths()* + Gets the paths contained in 'runtimepath'. + + Return:~ + List of paths + +nvim_set_current_dir({dir}) *nvim_set_current_dir()* + Changes the global working directory. + + Parameters:~ + {dir} Directory path + +nvim_get_current_line() *nvim_get_current_line()* + Gets the current line + + Parameters:~ + + Return:~ + Current line string + +nvim_set_current_line({line}) *nvim_set_current_line()* + Sets the current line + + Parameters:~ + {line} Line contents + +nvim_del_current_line() *nvim_del_current_line()* + Deletes the current line + + Parameters:~ + +nvim_get_var({name}) *nvim_get_var()* + Gets a global (g:) variable + + Parameters:~ + {name} Variable name + + Return:~ + Variable value + +nvim_set_var({name}, {value}) *nvim_set_var()* + Sets a global (g:) variable + + Parameters:~ + {name} Variable name + {value} Variable value + +nvim_del_var({name}) *nvim_del_var()* + Removes a global (g:) variable + + Parameters:~ + {name} Variable name + +nvim_get_vvar({name}) *nvim_get_vvar()* + Gets a v: variable + + Parameters:~ + {name} Variable name + + Return:~ + Variable value + +nvim_get_option({name}) *nvim_get_option()* + Gets an option value string + + Parameters:~ + {name} Option name + + Return:~ + Option value + +nvim_set_option({name}, {value}) *nvim_set_option()* + Sets an option value + + Parameters:~ + {name} Option name + {value} New option value + +nvim_out_write({str}) *nvim_out_write()* + Writes a message to vim output buffer + + Parameters:~ + {str} Message + +nvim_err_write({str}) *nvim_err_write()* + Writes a message to vim error buffer + + Parameters:~ + {str} Message + +nvim_err_writeln({str}) *nvim_err_writeln()* + Writes a message to vim error buffer. Appends a linefeed to + ensure all contents are written. + + Parameters:~ + {str} Message + +nvim_list_bufs() *nvim_list_bufs()* + Gets the current list of buffer handles + + Return:~ + List of buffer handles + +nvim_get_current_buf() *nvim_get_current_buf()* + Gets the current buffer + + Return:~ + Buffer handle + +nvim_set_current_buf({buffer}) *nvim_set_current_buf()* + Sets the current buffer + + Parameters:~ + {id} Buffer handle + +nvim_list_wins() *nvim_list_wins()* + Gets the current list of window handles + + Return:~ + List of window handles + +nvim_get_current_win() *nvim_get_current_win()* + Gets the current window + + Return:~ + Window handle + +nvim_set_current_win({window}) *nvim_set_current_win()* + Sets the current window + + Parameters:~ + {handle} Window handle + +nvim_list_tabpages() *nvim_list_tabpages()* + Gets the current list of tabpage handles + + Return:~ + List of tabpage handles + +nvim_get_current_tabpage() *nvim_get_current_tabpage()* + Gets the current tabpage + + Return:~ + Tabpage handle + +nvim_set_current_tabpage({tabpage}) *nvim_set_current_tabpage()* + Sets the current tabpage + + Parameters:~ + {handle} Tabpage handle + +nvim_subscribe({event}) *nvim_subscribe()* + Subscribes to event broadcasts + + Parameters:~ + {event} Event type string + +nvim_unsubscribe({event}) *nvim_unsubscribe()* + Unsubscribes to event broadcasts + + Parameters:~ + {event} Event type string + +nvim_get_color_by_name({name}) *nvim_get_color_by_name()* + TODO: Documentation + +nvim_get_color_map() *nvim_get_color_map()* + TODO: Documentation + +nvim_get_api_info() *nvim_get_api_info()* + TODO: Documentation + +nvim_call_atomic({calls}) *nvim_call_atomic()* + Call many api methods atomically + + This has two main usages: Firstly, to perform several requests + from an async context atomically, i.e. without processing + requests from other rpc clients or redrawing or allowing user + interaction in between. Note that api methods that could fire + autocommands or do event processing still might do so. For + instance invoking the :sleep command might call timer + callbacks. Secondly, it can be used to reduce rpc overhead + (roundtrips) when doing many requests in sequence. + + Parameters:~ + {calls} an array of calls, where each call is described + by an array with two elements: the request name, + and an array of arguments. + + Return:~ + an array with two elements. The first is an array of + return values. The second is NIL if all calls succeeded. + If a call resulted in an error, it is a three-element + array with the zero-based index of the call which resulted + in an error, the error type and the error message. If an + error ocurred, the values from all preceding calls will + still be returned. + + +============================================================================== +2. Buffer Functions *api-buffer* + +nvim_buf_line_count({buffer}) *nvim_buf_line_count()* + Gets the buffer line count + + Parameters:~ + {buffer} Buffer handle + + Return:~ + Line count + + *nvim_buf_get_lines()* +nvim_buf_get_lines({buffer}, {start}, {end}, {strict_indexing}) + Retrieves a line range from the buffer + + Indexing is zero-based, end-exclusive. Negative indices are + interpreted as length+1+index, i e -1 refers to the index past + the end. So to get the last element set start=-2 and end=-1. + + Out-of-bounds indices are clamped to the nearest valid value, + unless `strict_indexing` is set. + + Parameters:~ + {buffer} Buffer handle + {start} First line index + {end} Last line index (exclusive) + {strict_indexing} Whether out-of-bounds should be an + error. + + Return:~ + Array of lines + + *nvim_buf_set_lines()* +nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, + {replacement}) + Replaces line range on the buffer + + Indexing is zero-based, end-exclusive. Negative indices are + interpreted as length+1+index, i e -1 refers to the index past + the end. So to change or delete the last element set start=-2 + and end=-1. + + To insert lines at a given index, set both start and end to + the same index. To delete a range of lines, set replacement to + an empty array. + + Out-of-bounds indices are clamped to the nearest valid value, + unless `strict_indexing` is set. + + Parameters:~ + {buffer} Buffer handle + {start} First line index + {end} Last line index (exclusive) + {strict_indexing} Whether out-of-bounds should be an + error. + {replacement} Array of lines to use as replacement + +nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()* + Gets a buffer-scoped (b:) variable. + + Parameters:~ + {buffer} Buffer handle + {name} Variable name + + Return:~ + Variable value + +nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()* + Sets a buffer-scoped (b:) variable + + Parameters:~ + {buffer} Buffer handle + {name} Variable name + {value} Variable value + +nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()* + Removes a buffer-scoped (b:) variable + + Parameters:~ + {buffer} Buffer handle + {name} Variable name + +nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()* + Gets a buffer option value + + Parameters:~ + {buffer} Buffer handle + {name} Option name + + Return:~ + Option value + +nvim_buf_set_option({buffer}, {name}, {value}) *nvim_buf_set_option()* + Sets a buffer option value. Passing 'nil' as value deletes the + option (only works if there's a global fallback) + + Parameters:~ + {buffer} Buffer handle + {name} Option name + {value} Option value + +nvim_buf_get_number({buffer}) *nvim_buf_get_number()* + Gets the buffer number + + Parameters:~ + {buffer} Buffer handle + + Return:~ + Buffer number + +nvim_buf_get_name({buffer}) *nvim_buf_get_name()* + Gets the full file name for the buffer + + Parameters:~ + {buffer} Buffer handle + + Return:~ + Buffer name + +nvim_buf_set_name({buffer}, {name}) *nvim_buf_set_name()* + Sets the full file name for a buffer + + Parameters:~ + {buffer} Buffer handle + {name} Buffer name + +nvim_buf_is_valid({buffer}) *nvim_buf_is_valid()* + Checks if a buffer is valid + + Parameters:~ + {buffer} Buffer handle + + Return:~ + true if the buffer is valid, false otherwise + +nvim_buf_get_mark({buffer}, {name}) *nvim_buf_get_mark()* + Return a tuple (row,col) representing the position of the + named mark + + Parameters:~ + {buffer} Buffer handle + {name} Mark name + + Return:~ + (row, col) tuple + + *nvim_buf_add_highlight()* +nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line}, + {col_start}, {col_end}) + Adds a highlight to buffer. + + This can be used for plugins which dynamically generate + highlights to a buffer (like a semantic highlighter or + linter). The function adds a single highlight to a buffer. + Unlike matchaddpos() highlights follow changes to line + numbering (as lines are inserted/removed above the highlighted + line), like signs and marks do. + + "src_id" is useful for batch deletion/updating of a set of + highlights. When called with src_id = 0, an unique source id + is generated and returned. Succesive calls can pass in it as + "src_id" to add new highlights to the same source group. All + highlights in the same group can then be cleared with + nvim_buf_clear_highlight. If the highlight never will be + manually deleted pass in -1 for "src_id". + + If "hl_group" is the empty string no highlight is added, but a + new src_id is still returned. This is useful for an external + plugin to synchrounously request an unique src_id at + initialization, and later asynchronously add and clear + highlights in response to buffer changes. + + Parameters:~ + {buffer} Buffer handle + {src_id} Source group to use or 0 to use a new group, + or -1 for ungrouped highlight + {hl_group} Name of the highlight group to use + {line} Line to highlight + {col_start} Start of range of columns to highlight + {col_end} End of range of columns to highlight, or -1 + to highlight to end of line + + Return:~ + The src_id that was used + + *nvim_buf_clear_highlight()* +nvim_buf_clear_highlight({buffer}, {src_id}, {line_start}, {line_end}) + Clears highlights from a given source group and a range of + lines + + To clear a source group in the entire buffer, pass in 1 and -1 + to line_start and line_end respectively. + + Parameters:~ + {buffer} Buffer handle + {src_id} Highlight source group to clear, or -1 to + clear all. + {line_start} Start of range of lines to clear + {line_end} End of range of lines to clear (exclusive) + or -1 to clear to end of file. + + +============================================================================== +3. Window Functions *api-window* + +nvim_win_get_buf({window}) *nvim_win_get_buf()* + Gets the current buffer in a window + + Parameters:~ + {window} Window handle + + Return:~ + Buffer handle + +nvim_win_get_cursor({window}) *nvim_win_get_cursor()* + Gets the cursor position in the window + + Parameters:~ + {window} Window handle + + Return:~ + (row, col) tuple + +nvim_win_set_cursor({window}, {pos}) *nvim_win_set_cursor()* + Sets the cursor position in the window + + Parameters:~ + {window} Window handle + {pos} (row, col) tuple representing the new position + +nvim_win_get_height({window}) *nvim_win_get_height()* + Gets the window height + + Parameters:~ + {window} Window handle + + Return:~ + Height as a count of rows + +nvim_win_set_height({window}, {height}) *nvim_win_set_height()* + Sets the window height. This will only succeed if the screen + is split horizontally. + + Parameters:~ + {window} Window handle + {height} Height as a count of rows + +nvim_win_get_width({window}) *nvim_win_get_width()* + Gets the window width + + Parameters:~ + {window} Window handle + + Return:~ + Width as a count of columns + +nvim_win_set_width({window}, {width}) *nvim_win_set_width()* + Sets the window width. This will only succeed if the screen is + split vertically. + + Parameters:~ + {window} Window handle + {width} Width as a count of columns + +nvim_win_get_var({window}, {name}) *nvim_win_get_var()* + Gets a window-scoped (w:) variable + + Parameters:~ + {window} Window handle + {name} Variable name + + Return:~ + Variable value + +nvim_win_set_var({window}, {name}, {value}) *nvim_win_set_var()* + Sets a window-scoped (w:) variable + + Parameters:~ + {window} Window handle + {name} Variable name + {value} Variable value + +nvim_win_del_var({window}, {name}) *nvim_win_del_var()* + Removes a window-scoped (w:) variable + + Parameters:~ + {window} Window handle + {name} Variable name + +nvim_win_get_option({window}, {name}) *nvim_win_get_option()* + Gets a window option value + + Parameters:~ + {window} Window handle + {name} Option name + + Return:~ + Option value + +nvim_win_set_option({window}, {name}, {value}) *nvim_win_set_option()* + Sets a window option value. Passing 'nil' as value deletes the + option(only works if there's a global fallback) + + Parameters:~ + {window} Window handle + {name} Option name + {value} Option value + +nvim_win_get_position({window}) *nvim_win_get_position()* + Gets the window position in display cells. First position is + zero. + + Parameters:~ + {window} Window handle + + Return:~ + (row, col) tuple with the window position + +nvim_win_get_tabpage({window}) *nvim_win_get_tabpage()* + Gets the window tabpage + + Parameters:~ + {window} Window handle + + Return:~ + Tabpage that contains the window + +nvim_win_get_number({window}) *nvim_win_get_number()* + Gets the window number + + Parameters:~ + {window} Window handle + + Return:~ + Window number + +nvim_win_is_valid({window}) *nvim_win_is_valid()* + Checks if a window is valid + + Parameters:~ + {window} Window handle + + Return:~ + true if the window is valid, false otherwise + + +============================================================================== +4. Tabpage Functions *api-tabpage* + +nvim_tabpage_list_wins({tabpage}) *nvim_tabpage_list_wins()* + Gets the windows in a tabpage + + Parameters:~ + {tabpage} Tabpage + + Return:~ + List of windows in tabpage + +nvim_tabpage_get_var({tabpage}, {name}) *nvim_tabpage_get_var()* + Gets a tab-scoped (t:) variable + + Parameters:~ + {tabpage} Tabpage handle + {name} Variable name + + Return:~ + Variable value + +nvim_tabpage_set_var({tabpage}, {name}, {value}) *nvim_tabpage_set_var()* + Sets a tab-scoped (t:) variable + + Parameters:~ + {tabpage} Tabpage handle + {name} Variable name + {value} Variable value + +nvim_tabpage_del_var({tabpage}, {name}) *nvim_tabpage_del_var()* + Removes a tab-scoped (t:) variable + + Parameters:~ + {tabpage} Tabpage handle + {name} Variable name + +nvim_tabpage_get_win({tabpage}) *nvim_tabpage_get_win()* + Gets the current window in a tabpage + + Parameters:~ + {tabpage} Tabpage handle + + Return:~ + Window handle + +nvim_tabpage_get_number({tabpage}) *nvim_tabpage_get_number()* + Gets the tabpage number + + Parameters:~ + {tabpage} Tabpage handle + + Return:~ + Tabpage number + +nvim_tabpage_is_valid({tabpage}) *nvim_tabpage_is_valid()* + Checks if a tabpage is valid + + Parameters:~ + {tabpage} Tabpage handle + + Return:~ + true if the tabpage is valid, false otherwise + + +============================================================================== +5. UI Functions *api-ui* + +remote_ui_disconnect() *remote_ui_disconnect()* + TODO: Documentation + +nvim_ui_attach({width}, {height}, {options}) *nvim_ui_attach()* + TODO: Documentation + +nvim_ui_detach() *nvim_ui_detach()* + TODO: Documentation + +nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()* + TODO: Documentation + +nvim_ui_set_option({name}, {value}) *nvim_ui_set_option()* + TODO: Documentation + + vim:tw=78:ts=8:ft=help:norl:
\ No newline at end of file diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index ca79465e0d..171b0124f6 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1,31 +1,32 @@ -*api.txt* For Nvim. {Nvim} +*api.txt* {Nvim} NVIM REFERENCE MANUAL by Thiago de Arruda -The C API of Nvim *nvim-api* -1. Introduction |nvim-api-intro| -2. API Types |nvim-api-types| -3. API metadata |nvim-api-metadata| -4. Buffer highlighting |nvim-api-highlights| +C API for Nvim *API* *api* + +1. Introduction |api-intro| +2. API Types |api-types| +3. API metadata |api-metadata| +4. Buffer highlighting |api-highlights| ============================================================================== -1. Introduction *nvim-api-intro* +1. Introduction *api-intro* -Nvim defines a C API as the primary way for external code to interact with -the NVim core. In the present version of Nvim the API is primarily used by -external processes to interact with Nvim using the msgpack-rpc protocol, see -|msgpack-rpc|. The API will also be used from vimscript to access new Nvim core -features, but this is not implemented yet. Later on, Nvim might be embeddable -in C applications as libnvim, and the application will then control the -embedded instance by calling the C API directly. +Nvim exposes a public API for external code to interact with the Nvim core. +The API is used by external processes to interact with Nvim using the +msgpack-rpc protocol, see |msgpack-rpc|. The API is used from vimscript to +access some new Nvim core features. See |eval-api| for how api functions are +called from vimscript. Later on, Nvim might be embeddable in C applications as +libnvim, and the application will then control the embedded instance by calling +the C API directly. ============================================================================== -2. API Types *nvim-api-types* +2. API Types *api-types* Nvim's C API uses custom types for all functions. Some are just typedefs -around C99 standard types, and some are Nvim defined data structures. +around C99 standard types, and some are Nvim-defined data structures. Boolean -> bool Integer (signed 64-bit integer) -> int64_t @@ -46,19 +47,25 @@ Window -> enum value kObjectTypeWindow Tabpage -> enum value kObjectTypeTabpage ============================================================================== -3. API metadata *nvim-api-metadata* +3. API metadata *api-metadata* -Nvim exposes metadata about the API as a Dictionary with the following keys: +Nvim exposes API metadata as a Dictionary. Some items are described below: -functions calling signature of the API functions -types The custom handle types defined by Nvim -error_types The possible kinds of errors an API function can exit with. +version Nvim version, API level/compatibility +version.api_level Current API level +version.api_compatible API is backwards-compatible with this level +version.api_prerelease Declares the current API level as unstable > + (version.api_prerelease && fn.since == version.api_level) +functions API function signatures +{fn}.since API level where function {fn} was introduced +{fn}.deprecated_since API level where function {fn} was deprecated +types Custom handle types defined by Nvim +error_types Possible error types returned by API functions -This metadata is mostly useful for external programs accessing the api over -msgpack-api, see |msgpack-rpc-api|. +External programs ("clients") can use the metadata to discover the |rpc-api|. ============================================================================== -4. Buffer highlighting *nvim-api-highlights* +4. Buffer highlighting *api-highlights* Nvim allows plugins to add position-based highlights to buffers. This is similar to |matchaddpos()| but with some key differences. The added highlights @@ -72,10 +79,10 @@ Another use case are plugins that show output in an append-only buffer, and want to add highlights to the outputs. Highlight data cannot be preserved on writing and loading a buffer to file, nor in undo/redo cycles. -Highlights are registered using the |buffer_add_highlight| function, see the +Highlights are registered using the |nvim_buf_add_highlight| function, see the generated API documentation for details. If an external highlighter plugin is adding a large number of highlights in a batch, performance can be improved by -calling |buffer_add_highlight| as an asynchronous notification, after first +calling |nvim_buf_add_highlight| as an asynchronous notification, after first (synchronously) reqesting a source id. Here is an example using wrapper functions in the python client: > @@ -90,10 +97,19 @@ functions in the python client: buf.clear_highlight(src) < If the highlights don't need to be deleted or updated, just pass -1 as -src_id (this is the default in python). |buffer_clear_highlight| can be used -to clear highligts from a specific source, in a specific line range or the -entire buffer by passing in the line range 0, -1 (the later is the default +src_id (this is the default in python). |nvim_buf_clear_highlight| can be used +to clear highlights from a specific source, in a specific line range or the +entire buffer by passing in the line range 0, -1 (the latter is the default in python as used above). +An example of calling the api from vimscript: > + + call nvim_buf_set_lines(0, 0, 0, v:true, ["test text"]) + let src = nvim_buf_add_highlight(0, 0, "String", 1, 0, 4) + call nvim_buf_add_highlight(0, src, "Identifier", 0, 5, -1) + + " later + call nvim_buf_clear_highlight(0, src, 0, -1) +> ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 25ae94f784..180127cd52 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.4. Last change: 2015 Dec 05 +*autocmd.txt* For Vim version 7.4. Last change: 2016 Jun 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -49,9 +49,6 @@ effects. Be careful not to destroy your text. ============================================================================== 2. Defining autocommands *autocmd-define* -Note: The ":autocmd" command cannot be followed by another command, since any -'|' is considered part of the command. - *:au* *:autocmd* :au[tocmd] [group] {event} {pat} [nested] {cmd} Add {cmd} to the list of commands that Vim will @@ -64,6 +61,12 @@ Note: The ":autocmd" command cannot be followed by another command, since any The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand. See |autocmd-buflocal|. +Note: The ":autocmd" command can only be followed by another command when the +'|' appears before {cmd}. This works: > + :augroup mine | au! BufRead | augroup END +But this sees "augroup" as part of the defined command: > + :augroup mine | au BufRead * set tw=70 | augroup END + Note that special characters (e.g., "%", "<cword>") in the ":autocmd" arguments are not expanded when the autocommand is defined. These will be expanded when the Event is recognized, and the {cmd} is executed. The only @@ -256,7 +259,6 @@ Name triggered by ~ Options |FileType| when the 'filetype' option has been set |Syntax| when the 'syntax' option has been set -|EncodingChanged| after the 'encoding' option has been changed |TermChanged| after the value of 'term' has changed |OptionSet| after setting any option @@ -271,8 +273,10 @@ Name triggered by ~ |VimLeave| before exiting Vim, after writing the shada file Various +|DirChanged| after the |current-directory| was changed + |FileChangedShell| Vim notices that a file changed since editing started -|FileChangedShellPost| After handling a file changed since editing started +|FileChangedShellPost| after handling a file changed since editing started |FileChangedRO| before making the first change to a read-only file |ShellCmdPost| after executing a shell command @@ -292,6 +296,7 @@ Name triggered by ~ |CursorMoved| the cursor was moved in Normal mode |CursorMovedI| the cursor was moved in Insert mode +|WinNew| after creating a new window |WinEnter| after entering another window |WinLeave| before leaving a window |TabEnter| after entering another tab page @@ -542,6 +547,9 @@ CursorHold When the user doesn't press a key for the time *CursorHoldI* CursorHoldI Just like CursorHold, but in Insert mode. + Not triggered when waiting for another key, + e.g. after CTRL-V, and not when in CTRL-X mode + |insert_expand|. *CursorMoved* CursorMoved After the cursor was moved in Normal or Visual @@ -557,9 +565,12 @@ CursorMoved After the cursor was moved in Normal or Visual CursorMovedI After the cursor was moved in Insert mode. Not triggered when the popup menu is visible. Otherwise the same as CursorMoved. - *EncodingChanged* -EncodingChanged Fires off after the 'encoding' option has been - changed. Useful to set up fonts, for example. + *DirChanged* +DirChanged After the |current-directory| was changed. + Sets these |v:event| keys: + cwd: current working directory + scope: "global", "tab", "window" + Recursion is ignored. *FileAppendCmd* FileAppendCmd Before appending to a file. Should do the appending to the file. Use the '[ and '] @@ -618,9 +629,6 @@ FileChangedShell When Vim notices that the modification time of *FileChangedShellPost* FileChangedShellPost After handling a file that was changed outside of Vim. Can be used to update the statusline. - *FileEncoding* -FileEncoding Obsolete. It still works and is equivalent - to |EncodingChanged|. *FileReadCmd* FileReadCmd Before reading a file with a ":read" command. Should do the reading of the file. |Cmd-event| @@ -727,13 +735,12 @@ InsertCharPre When a character is typed in Insert mode, *TextYankPost* TextYankPost Just after a |yank| or |deleting| command, but not if the black hole register |quote_| is used nor - for |setreg()|. Pattern must be * because its - meaning may change in the future. + for |setreg()|. Pattern must be *. Sets these |v:event| keys: - operator - regcontents - regname - regtype + operator + regcontents + regname + regtype Recursion is ignored. It is not allowed to change the text |textlock|. *InsertEnter* @@ -912,8 +919,7 @@ TermClose When a terminal buffer ends. {Nvim} *TermOpen* TermOpen When a terminal buffer is starting. This can be used to configure the terminal emulator by - setting buffer variables. - See |nvim-terminal-emulator| for details. + setting buffer variables. |terminal-emulator| *TermResponse* TermResponse After the response to |t_RV| is received from the terminal. The value of |v:termresponse| @@ -948,7 +954,15 @@ VimEnter After doing all the startup stuff, including loading vimrc files, executing the "-c cmd" arguments, creating all windows and loading the buffers in them. - *VimLeave* + Just before this event is triggered the + |v:vim_did_enter| variable is set, so that you + can do: > + if v:vim_did_enter + call s:init() + else + au VimEnter * call s:init() + endif +< *VimLeave* VimLeave Before exiting Vim, just after writing the .shada file. Executed only once, like VimLeavePre. @@ -986,6 +1000,11 @@ WinLeave Before leaving a window. If the window to be WinLeave autocommands (but not for ":new"). Not used for ":qa" or ":q" when exiting Vim. + *WinNew* +WinNew When a new window was created. Not done for + the fist window, when Vim has just started. + Before a WinEnter event. + ============================================================================== 6. Patterns *autocmd-patterns* *{pat}* @@ -1223,6 +1242,8 @@ option will not cause any commands to be executed. argument is present. You probably want to use <nomodeline> for events that are not used when loading a buffer, such as |User|. + Processing modelines is also skipped when no + matching autocommands were executed. *:doautoa* *:doautoall* :doautoa[ll] [<nomodeline>] [group] {event} [fname] diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index c8eb0705f6..31a46f53bb 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.4. Last change: 2016 Jan 02 +*change.txt* For Vim version 7.4. Last change: 2016 Apr 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -97,10 +97,10 @@ These commands delete text. You can repeat them with the `.` command An exception for the d{motion} command: If the motion is not linewise, the start and end of the motion are not in the same line, and there are only -blanks before the start and after the end of the motion, the delete becomes -linewise. This means that the delete also removes the line of blanks that you -might expect to remain. Use the |o_v| operator to force the motion to be -characterwise. +blanks before the start and there are no non-blanks after the end of the +motion, the delete becomes linewise. This means that the delete also removes +the line of blanks that you might expect to remain. Use the |o_v| operator to +force the motion to be characterwise. Trying to delete an empty region of text (e.g., "d0" in the first column) is an error when 'cpoptions' includes the 'E' flag. @@ -108,7 +108,9 @@ is an error when 'cpoptions' includes the 'E' flag. *J* J Join [count] lines, with a minimum of two lines. Remove the indent and insert up to two spaces (see - below). + below). Fails when on the last line of the buffer. + If [count] is too big it is reduce to the number of + lines available. *v_J* {Visual}J Join the highlighted lines, with a minimum of two @@ -396,6 +398,11 @@ CTRL-X Subtract [count] from the number or alphabetic {Visual}CTRL-X Subtract [count] from the number or alphabetic character in the highlighted text. {not in Vi} + On MS-Windows, this is mapped to cut Visual text + |dos-standard-mappings|. If you want to disable the + mapping, use this: > + silent! vunmap <C-X> +< *v_g_CTRL-X* {Visual}g CTRL-X Subtract [count] from the number or alphabetic character in the highlighted text. If several lines @@ -806,7 +813,7 @@ Examples: > :s/abcde/abc^Mde/ modifies "abcde" to "abc", "de" (two lines) :s/$/\^M/ modifies "abcde" to "abcde^M" :s/\w\+/\u\0/g modifies "bla bla" to "Bla Bla" - :s/\w\+/\L\u/g modifies "BLA bla" to "Bla Bla" + :s/\w\+/\L\u\0/g modifies "BLA bla" to "Bla Bla" Note: "\L\u" can be used to capitalize the first letter of a word. This is not compatible with Vi and older versions of Vim, where the "\u" would cancel @@ -1157,7 +1164,7 @@ which does not specify a register. Additionally you can access it with the name '"'. This means you have to type two double quotes. Writing to the "" register writes to register "0. -2. Numbered registers "0 to "9 *quote_number* *quote0* *quote1* +2. Numbered registers "0 to "9 *quote_number* *quote0* *quote1* *quote2* *quote3* *quote4* *quote9* Vim fills these registers with text from yank and delete commands. Numbered register 0 contains the text from the most recent yank command, @@ -1245,7 +1252,7 @@ register. Use these registers for storing and retrieving the selected text for the GUI. See |quotestar| and |quoteplus|. When the clipboard is not available or not working, the unnamed register is used instead. For Unix systems and Mac OS X, -see |nvim-clipboard|. +see |primary-selection|. 9. Black hole register "_ *quote_* When writing to this register, nothing happens. This can be used to delete diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt new file mode 100644 index 0000000000..6997d331e4 --- /dev/null +++ b/runtime/doc/deprecated.txt @@ -0,0 +1,48 @@ +*deprecated.txt* {Nvim} + + + NVIM REFERENCE MANUAL + + +Nvim *deprecated* + +The items listed below are "deprecated". This means they will be removed in +the future. They should not be used in new scripts, and old scripts should be +updated. + +============================================================================== + +Normal commands ~ +*]f* +*[f* Same as "gf". + + +Commands ~ +*:rv* +*:rviminfo* Deprecated alias to |:rshada| command. +*:wv* +*:wviminfo* Deprecated alias to |:wshada| command. + + +Events ~ +*EncodingChanged* Never fired; 'encoding' is always "utf-8". +*FileEncoding* Never fired; equivalent to |EncodingChanged|. + +Highlight groups ~ +*hl-VisualNOS* Obsolete. |vim-differences| {Nvim} + +Functions ~ +*buffer_exists()* Obsolete name for |bufexists()|. +*buffer_name()* Obsolete name for |bufname()|. +*buffer_number()* Obsolete name for |bufnr()|. +*file_readable()* Obsolete name for |filereadable()|. +*highlight_exists()* Obsolete name for |hlexists()|. +*highlightID()* Obsolete name for |hlID()|. +*last_buffer_nr()* Obsolete name for bufnr("$"). + +Options ~ +*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. +*'vi'* +*'viminfo'* Deprecated alias to 'shada' option. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 668790358b..b738da9bec 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -1,23 +1,19 @@ -*develop.txt* For Vim version 7.4. Last change: 2014 Mar 27 +*develop.txt* - VIM REFERENCE MANUAL by Bram Moolenaar + NVIM REFERENCE MANUAL -Development of Vim. *development* - -This text is important for those who want to be involved in further developing -Vim. +Development of Nvim. *development* 1. Design goals |design-goals| 2. Design decisions |design-decisions| -See the file "src/nvim/README.md" for a high-level overview of the source -code. +Nvim is open source software. Everybody is encouraged to contribute. + https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md -Vim is open source software. Everybody is encouraged to contribute to help -improving Vim. For sending patches a context diff "diff -c" is preferred. -Also see http://vim.wikia.com/wiki/How_to_make_and_submit_a_patch. +See src/nvim/README.md for a high-level overview of the source code: + https://github.com/neovim/neovim/blob/master/src/nvim/README.md ============================================================================== 1. Design goals *design-goals* @@ -28,7 +24,7 @@ Note that quite a few items are contradicting. This is intentional. A balance must be found between them. -VIM IS... IMPROVED *design-improved* +NVIM IS... IMPROVED *design-improved* The IMproved bits of Vim should make it a better Vi, without becoming a completely different editor. Extensions are done with a "Vi spirit". @@ -49,7 +45,7 @@ completely different editor. Extensions are done with a "Vi spirit". implement and (3) someone actually implementing it. -VIM IS... MULTI PLATFORM *design-multi-platform* +NVIM IS... MULTI PLATFORM *design-multi-platform* Vim tries to help as many users on as many platforms as possible. - Support many kinds of terminals. The minimal demands are cursor positioning @@ -68,7 +64,7 @@ Vim tries to help as many users on as many platforms as possible. contradicts the previous item, these two must be balanced.] -VIM IS... WELL DOCUMENTED *design-documented* +NVIM IS... WELL DOCUMENTED *design-documented* - A feature that isn't documented is a useless feature. A patch for a new feature must include the documentation. @@ -76,9 +72,14 @@ VIM IS... WELL DOCUMENTED *design-documented* recommended. - Don't make the text unnecessarily long. Less documentation means that an item is easier to find. +- Do not prefix doc-tags with "nvim-". Use |vim_diff.txt| to document + differences from Vim. The {Nvim} annotation is also available + to mark a specific feature. No other distinction is necessary. +- If a feature is removed, delete its doc entry and move its tag to + |vim_diff.txt|. -VIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size* +NVIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size* Using Vim must not be a big attack on system resources. Keep it small and fast. @@ -89,13 +90,11 @@ fast. possible. Useful commands may take longer. - Don't forget that some people use Vim over a slow connection. Minimize the communication overhead. -- Items that add considerably to the size and are not used by many people - should be a feature that can be disabled. - Vim is a component among other components. Don't turn it into a massive application, but have it work well together with other programs. -VIM IS... MAINTAINABLE *design-maintain* +NVIM IS... MAINTAINABLE *design-maintain* - The source code should not become a mess. It should be reliable code. - Use comments in a useful way! Quoting the function name and argument names @@ -106,7 +105,7 @@ VIM IS... MAINTAINABLE *design-maintain* knowledge spread to other parts of the code. -VIM IS... FLEXIBLE *design-flexible* +NVIM IS... FLEXIBLE *design-flexible* Vim should make it easy for users to work in their preferred styles rather than coercing its users into particular patterns of work. This can be for @@ -117,28 +116,35 @@ be used to adjust Vim to the desire of the user and its environment. NVIM IS... NOT *design-not* -Nvim is not an Operating System; instead it should be composed with other -tools, or hosted as a component. Marvim once said: "Unlike Emacs, Nvim does -not attempt to include everything but the kitchen sink, but some people use it -for plumbing." +Nvim is not an operating system; instead it should be composed with other +tools or hosted as a component. Marvim once said: "Unlike Emacs, Nvim does not +include the kitchen sink... but you can use it for plumbing." ============================================================================== 2. Design decisions *design-decisions* -Folding - -Several forms of folding should be possible for the same buffer. For example, -have one window that shows the text with function bodies folded, another -window that shows a function body. +JARGON *dev-jargon* -Folding is a way to display the text. It should not change the text itself. -Therefore the folding has been implemented as a filter between the text stored -in a buffer (buffer lines) and the text displayed in a window (logical lines). +API client ~ +All external UIs and remote plugins (as opposed to regular Vim plugins) are +"clients" in general; but we call something an "API client" if its purpose is +to abstract or wrap the RPC API for the convenience of other applications +(just like a REST client or SDK such as boto3 for AWS: you can speak AWS REST +using an HTTP client like curl, but boto3 wraps that in a convenient python +interface). For example, the Nvim lua-client is an API client: + https://github.com/neovim/lua-client +Host ~ +A plugin "host" is both a client (of the Nvim API) and a server (of an +external platform, e.g. python). It is a remote plugin that hosts other +plugins. -Naming the window +Remote plugin ~ +Arbitrary code registered via |:UpdateRemotePlugins|, that runs in a separate +process and communicates with Nvim via the |api|. +Window ~ The word "window" is commonly used for several things: A window on the screen, the xterm window, a window inside Vim to view a buffer. To avoid confusion, other items that are sometimes called window have been @@ -152,111 +158,79 @@ window View on a buffer. There can be several windows in Vim, together with the command line, menubar, toolbar, etc. they fit in the shell. +PROVIDERS *dev-provider* + +A goal of Nvim is to allow extension of the editor without special knowledge +in the core. But some Vim components are too tightly coupled; in those cases +a "provider" hook is exposed. + +Consider two examples of integration with external systems that are +implemented in Vim and are now decoupled from Nvim core as providers: + +1. In the Vim source code, clipboard logic accounts for more than 1k lines of + C source code (ui.c), to perform two tasks that are now accomplished with + shell commands such as xclip or pbcopy/pbpaste. + +2. Python scripting support: Vim has three files dedicated to embedding the + Python interpreter: if_python.c, if_python3.c and if_py_both.h. Together + these files sum about 9.5k lines of C source code. In contrast, Nvim Python + scripting is performed by an external host process implemented in ~2k lines + of Python. + +Ideally we could implement Python and clipboard integration in pure vimscript +and without touching the C code. But this is infeasible without compromising +backwards compatibility with Vim; that's where providers help. + +The provider framework helps call vimscript from C. It is composed of two +functions in eval.c: + +- eval_call_provider(name, method, arguments): calls provider#(name)#Call + with the method and arguments. +- eval_has_provider(name): Checks if a provider is implemented. Returns true + if the provider#(name)#Call function is implemented. Called by |has()| + (vimscript) to check if features are available. + +The provider#(name)#Call function implements integration with an external +system, because shell commands and |RPC| clients are easier to work with in +vimscript. + +For example, the Python provider is implemented by the +autoload/provider/python.vim script; the provider#python#Call function is only +defined if a valid external Python host is found. That works well with the +`has('python')` expression (normally used by Python plugins) because if the +Python host isn't installed then the plugin will "think" it is running in +a Vim compiled without the |+python| feature. + + +API *dev-api* + +Use this pattern to name new API functions: + nvim_{thing}_{action}_{arbitrary-qualifiers} + +If the function acts on an object then {thing} is the name of that object +(e.g. "buf" or "win"). If the function operates in a "global" context then +{thing} is usually omitted (but consider "namespacing" your global operations +with a {thing} that groups functions under a common concept). + +Use existing common {action} names if possible: + add Append to, or insert into, a collection + get Get a thing (or subset of things by some query) + set Set a thing + del Delete a thing (or group of things) + list Get all things + +Use consistent names for {thing} in all API functions. E.g. a buffer is called +"buf" everywhere, not "buffer" in some places and "buf" in others. + +Example: `nvim_get_current_line` acts on the global editor state; the common +{action} "get" is used but {thing} is omitted. + +Example: `nvim_buf_add_highlight` acts on a `Buffer` object (the first +parameter) and uses the common {action} "add". + +Example: `nvim_list_bufs` operates in a global context (first parameter is +_not_ a Buffer). The common {action} "list" indicates that it lists all +bufs (plural) in the global context. -Spell checking *develop-spell* - -When spell checking was going to be added to Vim a survey was done over the -available spell checking libraries and programs. Unfortunately, the result -was that none of them provided sufficient capabilities to be used as the spell -checking engine in Vim, for various reasons: - -- Missing support for multi-byte encodings. At least UTF-8 must be supported, - so that more than one language can be used in the same file. - Doing on-the-fly conversion is not always possible (would require iconv - support). -- For the programs and libraries: Using them as-is would require installing - them separately from Vim. That's mostly not impossible, but a drawback. -- Performance: A few tests showed that it's possible to check spelling on the - fly (while redrawing), just like syntax highlighting. But the mechanisms - used by other code are much slower. Myspell uses a hashtable, for example. - The affix compression that most spell checkers use makes it slower too. -- For using an external program like aspell a communication mechanism would - have to be setup. That's complicated to do in a portable way (Unix-only - would be relatively simple, but that's not good enough). And performance - will become a problem (lots of process switching involved). -- Missing support for words with non-word characters, such as "Etten-Leur" and - "et al.", would require marking the pieces of them OK, lowering the - reliability. -- Missing support for regions or dialects. Makes it difficult to accept - all English words and highlight non-Canadian words differently. -- Missing support for rare words. Many words are correct but hardly ever used - and could be a misspelled often-used word. -- For making suggestions the speed is less important and requiring to install - another program or library would be acceptable. But the word lists probably - differ, the suggestions may be wrong words. - - -Spelling suggestions *develop-spell-suggestions* - -For making suggestions there are two basic mechanisms: -1. Try changing the bad word a little bit and check for a match with a good - word. Or go through the list of good words, change them a little bit and - check for a match with the bad word. The changes are deleting a character, - inserting a character, swapping two characters, etc. -2. Perform soundfolding on both the bad word and the good words and then find - matches, possibly with a few changes like with the first mechanism. - -The first is good for finding typing mistakes. After experimenting with -hashtables and looking at solutions from other spell checkers the conclusion -was that a trie (a kind of tree structure) is ideal for this. Both for -reducing memory use and being able to try sensible changes. For example, when -inserting a character only characters that lead to good words need to be -tried. Other mechanisms (with hashtables) need to try all possible letters at -every position in the word. Also, a hashtable has the requirement that word -boundaries are identified separately, while a trie does not require this. -That makes the mechanism a lot simpler. - -Soundfolding is useful when someone knows how the words sounds but doesn't -know how it is spelled. For example, the word "dictionary" might be written -as "daktonerie". The number of changes that the first method would need to -try is very big, it's hard to find the good word that way. After soundfolding -the words become "tktnr" and "tkxnry", these differ by only two letters. - -To find words by their soundfolded equivalent (soundalike word) we need a list -of all soundfolded words. A few experiments have been done to find out what -the best method is. Alternatives: -1. Do the sound folding on the fly when looking for suggestions. This means - walking through the trie of good words, soundfolding each word and - checking how different it is from the bad word. This is very efficient for - memory use, but takes a long time. On a fast PC it takes a couple of - seconds for English, which can be acceptable for interactive use. But for - some languages it takes more than ten seconds (e.g., German, Catalan), - which is unacceptable slow. For batch processing (automatic corrections) - it's too slow for all languages. -2. Use a trie for the soundfolded words, so that searching can be done just - like how it works without soundfolding. This requires remembering a list - of good words for each soundfolded word. This makes finding matches very - fast but requires quite a lot of memory, in the order of 1 to 10 Mbyte. - For some languages more than the original word list. -3. Like the second alternative, but reduce the amount of memory by using affix - compression and store only the soundfolded basic word. This is what Aspell - does. Disadvantage is that affixes need to be stripped from the bad word - before soundfolding it, which means that mistakes at the start and/or end - of the word will cause the mechanism to fail. Also, this becomes slow when - the bad word is quite different from the good word. - -The choice made is to use the second mechanism and use a separate file. This -way a user with sufficient memory can get very good suggestions while a user -who is short of memory or just wants the spell checking and no suggestions -doesn't use so much memory. - - -Word frequency - -For sorting suggestions it helps to know which words are common. In theory we -could store a word frequency with the word in the dictionary. However, this -requires storing a count per word. That degrades word tree compression a lot. -And maintaining the word frequency for all languages will be a heavy task. -Also, it would be nice to prefer words that are already in the text. This way -the words that appear in the specific text are preferred for suggestions. - -What has been implemented is to count words that have been seen during -displaying. A hashtable is used to quickly find the word count. The count is -initialized from words listed in COMMON items in the affix file, so that it -also works when starting a new file. - -This isn't ideal, because the longer Vim is running the higher the counts -become. But in practice it is a noticeable improvement over not using the word -count. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 12bc655edc..6b45f8552f 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,12 +1,12 @@ -*diff.txt* For Vim version 7.4. Last change: 2015 Nov 01 +*diff.txt* For Vim version 7.4. Last change: 2016 Aug 24 VIM REFERENCE MANUAL by Bram Moolenaar *diff* *diff-mode* -This file describes |diff-mode|, which shows the differences between two, -three, or four versions of the same file. +This file describes the |+diff| feature: Showing differences between two to +eight versions of the same file. The basics are explained in section |08.7| of the user manual. @@ -109,7 +109,7 @@ To make these commands use a vertical split, prepend |:vertical|. Examples: > If you always prefer a vertical split include "vertical" in 'diffopt'. *E96* -There can be up to four buffers with 'diff' set. +There can be up to eight buffers with 'diff' set. Since the option values are remembered with the buffer, you can edit another file for a moment and come back to the same file and be in diff mode again. diff --git a/runtime/doc/doctags.c b/runtime/doc/doctags.c deleted file mode 100644 index 9213dd9c1e..0000000000 --- a/runtime/doc/doctags.c +++ /dev/null @@ -1,83 +0,0 @@ -/* vim:set ts=4 sw=4: - * this program makes a tags file for vim_ref.txt - * - * Usage: doctags vim_ref.txt vim_win.txt ... >tags - * - * A tag in this context is an identifier between stars, e.g. *c_files* - */ - -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <stdlib.h> - -#define LINELEN 200 - - int -main(argc, argv) - int argc; - char **argv; -{ - char line[LINELEN]; - char *p1, *p2; - char *p; - FILE *fd; - - if (argc <= 1) - { - fprintf(stderr, "Usage: doctags docfile ... >tags\n"); - exit(1); - } - printf("help-tags\ttags\t1\n"); - while (--argc > 0) - { - ++argv; - fd = fopen(argv[0], "r"); - if (fd == NULL) - { - fprintf(stderr, "Unable to open %s for reading\n", argv[0]); - continue; - } - while (fgets(line, LINELEN, fd) != NULL) - { - p1 = strchr(line, '*'); /* find first '*' */ - while (p1 != NULL) - { - p2 = strchr(p1 + 1, '*'); /* find second '*' */ - if (p2 != NULL && p2 > p1 + 1) /* skip "*" and "**" */ - { - for (p = p1 + 1; p < p2; ++p) - if (*p == ' ' || *p == '\t' || *p == '|') - break; - /* - * Only accept a *tag* when it consists of valid - * characters, there is white space before it and is - * followed by a white character or end-of-line. - */ - if (p == p2 - && (p1 == line || p1[-1] == ' ' || p1[-1] == '\t') - && (strchr(" \t\n\r", p[1]) != NULL - || p[1] == '\0')) - { - *p2 = '\0'; - ++p1; - printf("%s\t%s\t/*", p1, argv[0]); - while (*p1) - { - /* insert backslash before '\\' and '/' */ - if (*p1 == '\\' || *p1 == '/') - putchar('\\'); - putchar(*p1); - ++p1; - } - printf("*\n"); - p2 = strchr(p2 + 1, '*'); /* find next '*' */ - } - } - p1 = p2; - } - } - fclose(fd); - } - return 0; -} diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index c51286a350..5bfffac1f1 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2016 Jan 03 +*editing.txt* For Vim version 7.4. Last change: 2016 Aug 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -267,9 +267,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is files. See |CTRL-^| above for further details. -[count]]f *]f* *[f* -[count][f Same as "gf". Deprecated. - *gf* *E446* *E447* [count]gf Edit the file whose name is under or after the cursor. Mnemonic: "goto file". @@ -358,7 +355,7 @@ These are the common ones: To avoid the special meaning of the wildcards prepend a backslash. However, on MS-Windows the backslash is a path separator and "path\[abc]" is still seen as a wildcard when "[" is in the 'isfname' option. A simple way to avoid this -is to use "path\[[]abc]". Then the file "path[abc]" literally. +is to use "path\[[]abc]", this matches the file "path\[abc]". *starstar-wildcard* Expanding "**" is possible on Unix, Win32, Mac OS/X and a few other systems. @@ -368,16 +365,21 @@ Note there are some commands where this works slightly differently, see Example: > :n **/*.txt Finds files: - ttt.txt - subdir/ttt.txt - a/b/c/d/ttt.txt -When non-wildcard characters are used these are only matched in the first -directory. Example: > - :n /usr/inc**/*.h + aaa.txt ~ + subdir/bbb.txt ~ + a/b/c/d/ccc.txt ~ +When non-wildcard characters are used right before or after "**" these are +only matched in the top directory. They are not used for directories further +down in the tree. For example: > + :n /usr/inc**/types.h Finds files: - /usr/include/types.h - /usr/include/sys/types.h - /usr/inc_old/types.h + /usr/include/types.h ~ + /usr/include/sys/types.h ~ + /usr/inc/old/types.h ~ +Note that the path with "/sys" is included because it does not need to match +"/inc". Thus it's like matching "/usr/inc*/*/*...", not +"/usr/inc*/inc*/inc*". + *backtick-expansion* *`-expansion* On Unix and a few other systems you can also use backticks for the file name argument, for example: > @@ -596,6 +598,7 @@ list of the current window. :0argadd x x a b c :1argadd x a x b c :$argadd x a b c x + And after the last one: :+2argadd y a b c x y There is no check for duplicates, it is possible to add a file to the argument list twice. @@ -946,7 +949,7 @@ the newly written file (it might be there but contain bogus data). In that case try recovery, because the swap file is synced to disk and might still be there. |:recover| -The directories given with the 'backupdir' option is used to put the backup +The directories given with the 'backupdir' option are used to put the backup file in. (default: same directory as the written file). Whether the backup is a new file, which is a copy of the original file, or the @@ -1043,10 +1046,12 @@ The names can be in upper- or lowercase. edited. See |:confirm| and 'confirm'. :q[uit]! Quit without writing, also when the current buffer has - changes. If this is the last window and there is a - modified hidden buffer, the current buffer is - abandoned and the first changed hidden buffer becomes - the current buffer. + changes. The buffer is unloaded, also when it has + 'hidden' set. + If this is the last window and there is a modified + hidden buffer, the current buffer is abandoned and the + first changed hidden buffer becomes the current + buffer. Use ":qall!" to exit always. :cq[uit] Quit always, without writing, and return an error @@ -1147,7 +1152,7 @@ Examples: > If you want to always use ":confirm", set the 'confirm' option. - *:browse* *:bro* *E338* *E614* *E615* *E616* *E578* + *:browse* *:bro* *E338* *E614* *E615* *E616* :bro[wse] {command} Open a file selection dialog for an argument to {command}. At present this works for |:e|, |:w|, |:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|, diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index eebdabd154..9aa60657e0 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2016 Jan 16 +*eval.txt* For Vim version 7.4. Last change: 2016 Aug 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -43,11 +43,15 @@ Number A 32 or 64 bit signed number. |expr-number| *Number* Float A floating point number. |floating-point-format| *Float* Examples: 123.456 1.15e-6 -1.1e3 + *E928* String A NUL terminated string of 8-bit unsigned characters (bytes). |expr-string| Examples: "ab\txx\"--" 'x-z''a,c' Funcref A reference to a function |Funcref|. Example: function("strlen") + It can be bound to a dictionary and arguments, it then works + like a Partial. + Example: function("Callback", [arg], myDict) List An ordered sequence of items |List|. Example: [1, 2, ['a', 'b']] @@ -100,18 +104,12 @@ When mixing Number and Float the Number is converted to Float. Otherwise there is no automatic conversion of Float. You can use str2float() for String to Float, printf() for Float to String and float2nr() for Float to Number. - *E706* *sticky-type-checking* -You will get an error if you try to change the type of a variable. You need -to |:unlet| it first to avoid this error. String and Number are considered -equivalent though, as well are Float and Number. Consider this sequence of -commands: > - :let l = "string" - :let l = 44 " changes type from String to Number - :let l = [1, 2, 3] " error! l is still a Number - :let l = 4.4 " changes type from Number to Float - :let l = "string" " error! - + *E891* *E892* *E893* *E894* +When expecting a Float a Number can also be used, but nothing else. + *no-type-checking* +You will not get an error if you try to change the type of a variable. + 1.2 Function references ~ *Funcref* *E695* *E718* A Funcref variable is obtained with the |function()| function. It can be used @@ -144,6 +142,40 @@ The name of the referenced function can be obtained with |string()|. > You can use |call()| to invoke a Funcref and use a list variable for the arguments: > :let r = call(Fn, mylist) +< + *Partial* +A Funcref optionally binds a Dictionary and/or arguments. This is also called +a Partial. This is created by passing the Dictionary and/or arguments to +function(). When calling the function the Dictionary and/or arguments will be +passed to the function. Example: > + + let Cb = function('Callback', ['foo'], myDict) + call Cb() + +This will invoke the function as if using: > + call myDict.Callback('foo') + +Note that binding a function to a Dictionary also happens when the function is +a member of the Dictionary: > + + let myDict.myFunction = MyFunction + call myDict.myFunction() + +Here MyFunction() will get myDict passed as "self". This happens when the +"myFunction" member is accessed. When assigning "myFunction" to otherDict +and calling it, it will be bound to otherDict: > + + let otherDict.myFunction = myDict.myFunction + call otherDict.myFunction() + +Now "self" will be "otherDict". But when the dictionary was bound explicitly +this won't happen: > + + let myDict.myFunction = function(MyFunction, myDict) + let otherDict.myFunction = myDict.myFunction + call otherDict.myFunction() + +Here "self" will be "myDict", because it was bound explitly. 1.3 Lists ~ @@ -410,7 +442,8 @@ only appear once. Examples: > A key is always a String. You can use a Number, it will be converted to a String automatically. Thus the String '4' and the number 4 will find the same entry. Note that the String '04' and the Number 04 are different, since the -Number will be converted to the String '4'. +Number will be converted to the String '4'. The empty string can be used as a +key. A value can be any expression. Using a Dictionary for a value creates a nested Dictionary: > @@ -750,22 +783,40 @@ A |Dictionary| can only be compared with a |Dictionary| and only "equal", "not equal" and "is" can be used. This compares the key/values of the |Dictionary| recursively. Ignoring case means case is ignored when comparing item values. - *E693* *E694* -A |Funcref| can only be compared with a |Funcref| and only "equal" and "not -equal" can be used. Case is never ignored. + *E694* +A |Funcref| can only be compared with a |Funcref| and only "equal", "not +equal", "is" and "isnot" can be used. Case is never ignored. Whether +arguments or a Dictionary are bound (with a partial) matters. The +Dictionaries must also be equal (or the same, in case of "is") and the +arguments must be equal (or the same). + +To compare Funcrefs to see if they refer to the same function, ignoring bound +Dictionary and arguments, use |get()| to get the function name: > + if get(Part1, 'name') == get(Part2, 'name') + " Part1 and Part2 refer to the same function When using "is" or "isnot" with a |List| or a |Dictionary| this checks if the expressions are referring to the same |List| or |Dictionary| instance. A copy of a |List| is different from the original |List|. When using "is" without a |List| or a |Dictionary| it is equivalent to using "equal", using "isnot" equivalent to using "not equal". Except that a different type means the -values are different: "4 == '4'" is true, "4 is '4'" is false and "0 is []" is -false and not an error. "is#"/"isnot#" and "is?"/"isnot?" can be used to match -and ignore case. +values are different: > + echo 4 == '4' + 1 + echo 4 is '4' + 0 + echo 0 is [] + 0 +"is#"/"isnot#" and "is?"/"isnot?" can be used to match and ignore case. When comparing a String with a Number, the String is converted to a Number, -and the comparison is done on Numbers. This means that "0 == 'x'" is TRUE, -because 'x' converted to a Number is zero. +and the comparison is done on Numbers. This means that: > + echo 0 == 'x' + 1 +because 'x' converted to a Number is zero. However: > + echo 0 == 'x' + 0 +Inside a List or Dictionary this conversion is not used. When comparing two Strings, this is done with strcmp() or stricmp(). This results in the mathematical difference (comparing byte values), not @@ -858,11 +909,12 @@ These three can be repeated and mixed. Examples: expr8 *expr8* ----- expr8[expr1] item of String or |List| *expr-[]* *E111* + *subscript* If expr8 is a Number or String this results in a String that contains the expr1'th single byte from expr8. expr8 is used as a String, expr1 as a Number. This doesn't recognize multi-byte encodings, see |byteidx()| for -an alternative. +an alternative, or use `split()` to turn the string into a list of characters. Index zero gives the first byte. This is like it works in C. Careful: text column numbers start with one! Example, to get the byte under the @@ -870,7 +922,7 @@ cursor: > :let c = getline(".")[col(".") - 1] If the length of the String is less than the index, the result is an empty -String. A negative index always results in an empty string (reason: backwards +String. A negative index always results in an empty string (reason: backward compatibility). Use [-1:] to get the last byte. If expr8 is a |List| then it results the item at index expr1. See |list-index| @@ -1022,8 +1074,8 @@ A string constant accepts these special characters: \x. byte specified with one hex number (must be followed by non-hex char) \X.. same as \x.. \X. same as \x. -\u.... character specified with up to 4 hex numbers, stored according to the - current value of 'encoding' (e.g., "\u02a4") +\u.... character specified with up to 4 hex numbers, stored as UTF-8 + (e.g., "\u02a4") \U.... same as \u but allows up to 8 hex numbers. \b backspace <BS> \e escape <Esc> @@ -1038,8 +1090,7 @@ A string constant accepts these special characters: utf-8 character, use \uxxxx as mentioned above. Note that "\xff" is stored as the byte 255, which may be invalid in some -encodings. Use "\u00ff" to store character 255 according to the current value -of 'encoding'. +encodings. Use "\u00ff" to store character 255 correctly as UTF-8. Note that "\000" and "\x00" force the end of the string. @@ -1299,6 +1350,10 @@ v:beval_winnr The number of the window, over which the mouse pointer is. Only window has number zero (unlike most other places where a window gets a number). + *v:beval_winid* *beval_winid-variable* +v:beval_winid The window ID of the window, over which the mouse pointer is. + Otherwise like v:beval_winnr. + *v:char* *char-variable* v:char Argument for evaluating 'formatexpr' and used for the typed character when using <expr> in an abbreviation |:map-<expr>|. @@ -1373,6 +1428,9 @@ v:dying Normally zero. When a deadly signal is caught it's set to < Note: if another deadly signal is caught when v:dying is one, VimLeave autocommands will not be executed. + *v:exiting* *exiting-variable* +v:exiting The exit value Nvim will use. Before exiting, it is |v:null|. + *v:errmsg* *errmsg-variable* v:errmsg Last given error message. It's allowed to set this variable. Example: > @@ -1420,7 +1478,7 @@ v:exception The value of the exception most recently caught and not *v:false* *false-variable* v:false Special value used to put "false" in JSON and msgpack. See - |json_encode()|. This value is converted to "false" when used + |json_encode()|. This value is converted to "v:false" when used as a String (e.g. in |expr5| with string concatenation operator) and to zero when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). @@ -1548,6 +1606,10 @@ v:mouse_win Window number for a mouse click obtained with |getchar()|. First window has number 1, like with |winnr()|. The value is zero when there was no mouse button click. + *v:mouse_winid* *mouse_winid-variable* +v:mouse_winid Window ID for a mouse click obtained with |getchar()|. + The value is zero when there was no mouse button click. + *v:mouse_lnum* *mouse_lnum-variable* v:mouse_lnum Line number for a mouse click obtained with |getchar()|. This is the text line number, not the screen line number. The @@ -1566,7 +1628,7 @@ v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| *v:null* *null-variable* v:null Special value used to put "null" in JSON and NIL in msgpack. - See |json_encode()|. This value is converted to "null" when + See |json_encode()|. This value is converted to "v:null" when used as a String (e.g. in |expr5| with string concatenation operator) and to zero when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). @@ -1650,9 +1712,9 @@ v:scrollstart String describing the script or function that caused the hit-enter prompt. *v:servername* *servername-variable* + *$NVIM_LISTEN_ADDRESS* v:servername Default {Nvim} server address. Equivalent to - |$NVIM_LISTEN_ADDRESS| on startup, but may differ if the - latter is modified or unset. |serverstop()| + |$NVIM_LISTEN_ADDRESS| on startup. |serverstop()| Read-only. @@ -1704,6 +1766,21 @@ v:swapcommand Normal mode command to be executed after a file has been example, when jumping to a tag the value is ":tag tagname\r". For ":edit +cmd file" the value is ":cmd\r". + *v:t_TYPE* *v:t_bool* *t_bool-varialble* +v:t_bool Value of Boolean type. Read-only. See: |type()| + *v:t_dict* *t_dict-varialble* +v:t_dict Value of Dictionary type. Read-only. See: |type()| + *v:t_float* *t_float-varialble* +v:t_float Value of Float type. Read-only. See: |type()| + *v:t_func* *t_func-varialble* +v:t_func Value of Funcref type. Read-only. See: |type()| + *v:t_list* *t_list-varialble* +v:t_list Value of List type. Read-only. See: |type()| + *v:t_number* *t_number-varialble* +v:t_number Value of Number type. Read-only. See: |type()| + *v:t_string* *t_string-varialble* +v:t_string Value of String type. Read-only. See: |type()| + *v:termresponse* *termresponse-variable* v:termresponse The escape sequence returned by the terminal for the |t_RV| termcap entry. It is set when Vim receives an escape sequence @@ -1738,7 +1815,7 @@ v:throwpoint The point where the exception most recently caught and not *v:true* *true-variable* v:true Special value used to put "true" in JSON and msgpack. See - |json_encode()|. This value is converted to "true" when used + |json_encode()|. This value is converted to "v:true" when used as a String (e.g. in |expr5| with string concatenation operator) and to one when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). @@ -1759,13 +1836,17 @@ v:version Version number of Vim: Major version number times 100 plus version 5.0 and 5.1 may have a patch 123, but these are completely different. + *v:vim_did_enter* *vim_did_enter-variable* +v:vim_did_enter Zero until most of startup is done. It is set to one just + before |VimEnter| autocommands are triggered. + *v:warningmsg* *warningmsg-variable* v:warningmsg Last given warning message. It's allowed to set this variable. *v:windowid* *windowid-variable* {Nvim} v:windowid Application-specific window ID ("window handle" in MS-Windows) which may be set by any attached UI. Defaults to zero. - Note: for windows inside Vim use |winnr()|. + Note: for windows inside Vim use |winnr()| or |win_getid()|. ============================================================================== 4. Builtin Functions *functions* @@ -1780,6 +1861,7 @@ abs({expr}) Float or Number absolute value of {expr} acos({expr}) Float arc cosine of {expr} add({list}, {item}) List append {item} to |List| {list} and({expr}, {expr}) Number bitwise AND +api_info() Dict api metadata append({lnum}, {string}) Number append {string} below line {lnum} append({lnum}, {list}) Number append lines {list} below line {lnum} argc() Number number of files in the argument list @@ -1787,9 +1869,13 @@ argidx() Number current index in the argument list arglistid([{winnr} [, {tabnr}]]) Number argument list id argv({nr}) String {nr} entry of the argument list argv() List the argument list -assert_equal({exp}, {act} [, {msg}]) none assert {exp} equals {act} -assert_exception({error} [, {msg}]) none assert {error} is in v:exception +assert_equal({exp}, {act} [, {msg}]) none assert {exp} is equal to {act} +assert_exception( {error} [, {msg}]) none assert {error} is in v:exception +assert_fails( {cmd} [, {error}]) none assert {cmd} fails assert_false({actual} [, {msg}]) none assert {actual} is false +assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text} +assert_notequal( {exp}, {act} [, {msg}]) none assert {exp} is not equal {act} +assert_notmatch( {pat}, {text} [, {msg}]) none assert {pat} not matches {text} assert_true({actual} [, {msg}]) none assert {actual} is true asin({expr}) Float arc sine of {expr} atan({expr}) Float arc tangent of {expr} @@ -1802,6 +1888,7 @@ buflisted({expr}) Number TRUE if buffer {expr} is listed bufloaded({expr}) Number TRUE if buffer {expr} is loaded bufname({expr}) String Name of the buffer {expr} bufnr({expr} [, {create}]) Number Number of the buffer {expr} +bufwinid({expr}) Number window ID of buffer {expr} bufwinnr({expr}) Number window number of buffer {expr} byte2line({byte}) Number line number at byte count {byte} byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr} @@ -1843,6 +1930,7 @@ escape({string}, {chars}) String escape {chars} in {string} with '\' eval({string}) any evaluate {string} into its value eventhandler() Number TRUE if inside an event handler executable({expr}) Number 1 if executable {expr} exists +execute({command}) String execute and capture output of {command} exepath({expr}) String full path of the command {expr} exists({expr}) Number TRUE if {expr} exists extend({expr1}, {expr2} [, {expr3}]) @@ -1870,10 +1958,13 @@ foldlevel({lnum}) Number fold level at {lnum} foldtext() String line displayed for closed fold foldtextresult({lnum}) String text for closed fold at {lnum} foreground() Number bring the Vim window to the foreground -function({name}) Funcref reference to function {name} +function({name} [, {arglist}] [, {dict}]) + Funcref reference to function {name} garbagecollect([{atexit}]) none free memory, breaking cyclic references get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def} get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def} +get({func}, {what}) any get property of funcref/partial {func} +getbufinfo( [{expr}]) List information about buffers getbufline({expr}, {lnum} [, {end}]) List lines {lnum} to {end} of buffer {expr} getbufvar({expr}, {varname} [, {def}]) @@ -1885,8 +1976,10 @@ getcmdline() String return the current command-line getcmdpos() Number return cursor position in command-line getcmdtype() String return current command-line type getcmdwintype() String return current command-line window type +getcompletion({pat}, {type} [, {filtered}]) + List list of cmdline completion matches getcurpos() List position of the cursor -getcwd([{scope}]) String the current working directory +getcwd([{winnr} [, {tabnr}]]) String the current working directory getfontname([{name}]) String name of font being used getfperm({fname}) String file permissions of file {fname} getfsize({fname}) Number size in bytes of file {fname} @@ -1902,10 +1995,12 @@ getqflist() List list of quickfix items getreg([{regname} [, 1 [, {list}]]]) String or List contents of register getregtype([{regname}]) String type of register +gettabinfo( [{expr}]) List list of tab pages gettabvar({nr}, {varname} [, {def}]) any variable {varname} in tab {nr} or {def} gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) any {name} in {winnr} in tab page {tabnr} +getwininfo( [{winid}]) List list of windows getwinposx() Number X coord in pixels of GUI Vim window getwinposy() Number Y coord in pixels of GUI Vim window getwinvar({nr}, {varname} [, {def}]) @@ -1917,10 +2012,11 @@ globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) String do glob({expr}) for all dirs in {path} has({feature}) Number TRUE if feature {feature} supported has_key({dict}, {key}) Number TRUE if {dict} has entry {key} -haslocaldir() Number TRUE if current window executed |:lcd| +haslocaldir([{winnr} [, {tabnr}]]) + Number TRUE if current window executed |:lcd| hasmapto({what} [, {mode} [, {abbr}]]) Number TRUE if mapping to {what} exists -histadd({history},{item}) String add an item to a history +histadd({history}, {item}) String add an item to a history histdel({history} [, {item}]) String remove an item from a history histget({history} [, {index}]) String get the item {index} from a history histnr({history}) Number highest index of a history @@ -1986,6 +2082,8 @@ matchlist({expr}, {pat}[, {start}[, {count}]]) List match and submatches of {pat} in {expr} matchstr({expr}, {pat}[, {start}[, {count}]]) String {count}'th match of {pat} in {expr} +matchstrpos( {expr}, {pat}[, {start}[, {count}]]) + List {count}'th match of {pat} in {expr} max({list}) Number maximum value of items in {list} min({list}) Number minimum value of items in {list} mkdir({name} [, {path} [, {prot}]]) @@ -1995,6 +2093,7 @@ msgpackdump({list}) List dump a list of objects to msgpack msgpackparse({list}) List parse msgpack to a list of objects nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} +nvim_...({args}...) any call nvim |api| functions or({expr}, {expr}) Number bitwise OR pathshorten({expr}) String shorten directory names in a path pow({x}, {y}) Float {x} to the power of {y} @@ -2018,7 +2117,7 @@ remote_peek({serverid} [, {retvar}]) remote_read({serverid}) String read reply string remote_send({server}, {string} [, {idvar}]) String send key sequence -remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} +remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} remove({dict}, {key}) any remove entry {key} from {dict} rename({from}, {to}) Number rename (move) file from {from} to {to} repeat({expr}, {count}) String repeat {expr} {count} times @@ -2026,11 +2125,10 @@ resolve({filename}) String get filename a shortcut points to reverse({list}) List reverse {list} in-place round({expr}) Float round off {expr} rpcnotify({channel}, {event}[, {args}...]) - Sends a |msgpack-rpc| notification to {channel} + Sends an |RPC| notification to {channel} rpcrequest({channel}, {method}[, {args}...]) - Sends a |msgpack-rpc| request to {channel} -rpcstart({prog}[, {argv}]) Spawns {prog} and opens a |msgpack-rpc| channel -rpcstop({channel}) Closes a |msgpack-rpc| {channel} + Sends an |RPC| request to {channel} +rpcstop({channel}) Closes an |RPC| {channel} screenattr({row}, {col}) Number attribute at screen position screenchar({row}, {col}) Number character at screen position screencol() Number current cursor column @@ -2084,14 +2182,17 @@ sqrt({expr}) Float square root of {expr} str2float({expr}) Float convert String to Float str2nr({expr} [, {base}]) Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} +strcharpart({str}, {start}[, {len}]) + String {len} characters of {str} at {start} strdisplaywidth({expr} [, {col}]) Number display length of the String {expr} strftime({format}[, {time}]) String time in specified format +strgetchar({str}, {index}) Number get char {index} from {str} stridx({haystack}, {needle}[, {start}]) Number index of {needle} in {haystack} string({expr}) String String representation of {expr} value strlen({expr}) Number length of the String {expr} -strpart({src}, {start}[, {len}]) - String {len} characters of {src} at {start} +strpart({str}, {start}[, {len}]) + String {len} characters of {str} at {start} strridx({haystack}, {needle} [, {start}]) Number last index of {needle} in {haystack} strtrans({expr}) String translate string to make it printable @@ -2108,15 +2209,18 @@ synconcealed({lnum}, {col}) List info about concealing synstack({lnum}, {col}) List stack of syntax IDs at {lnum} and {col} system({cmd} [, {input}]) String output of shell command/filter {cmd} systemlist({cmd} [, {input}]) List output of shell command/filter {cmd} -tabpagebuflist([{arg}]) List list of buffer numbers in tab page +tabpagebuflist([{arg}]) List list of buffer numbers in tab page tabpagenr([{arg}]) Number number of current or last tab page tabpagewinnr({tabarg}[, {arg}]) Number number of current window in tab page taglist({expr}) List list of tags matching {expr} tagfiles() List tags files used -tempname() String name for a temporary file tan({expr}) Float tangent of {expr} tanh({expr}) Float hyperbolic tangent of {expr} +tempname() String name for a temporary file +timer_start({time}, {callback} [, {options}]) + Number create a timer +timer_stop({timer}) none stop a timer tolower({expr}) String the String {expr} switched to lowercase toupper({expr}) String the String {expr} switched to uppercase tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} @@ -2131,6 +2235,11 @@ values({dict}) List values in {dict} virtcol({expr}) Number screen column of cursor or mark visualmode([expr]) String last visual mode used wildmenumode() Number whether 'wildmenu' mode is active +win_findbuf( {bufnr}) List find windows containing {bufnr} +win_getid( [{win} [, {tab}]]) Number get window ID for {win} in {tab} +win_gotoid( {expr}) Number go to window with ID {expr} +win_id2tabwin( {expr}) List get tab window nr from window ID +win_id2win( {expr}) Number get window nr from window ID winbufnr({nr}) Number buffer number of window {nr} wincol() Number window column of the cursor winheight({nr}) Number height of window {nr} @@ -2145,6 +2254,7 @@ writefile({list}, {fname} [, {flags}]) Number write list of lines to file {fname} xor({expr}, {expr}) Number bitwise XOR + abs({expr}) *abs()* Return the absolute value of {expr}. When {expr} evaluates to a |Float| abs() returns a |Float|. When {expr} can be @@ -2187,6 +2297,8 @@ and({expr}, {expr}) *and()* Example: > :let flag = and(bits, 0x80) +api_info() *api_info()* + Returns Dictionary of |api-metadata|. append({lnum}, {expr}) *append()* When {expr} is a |List|: Append each item of the |List| as a @@ -2208,7 +2320,7 @@ argidx() The result is the current index in the argument list. 0 is the first file. argc() - 1 is the last one. See |arglist|. *arglistid()* -arglistid([{winnr}, [ {tabnr} ]]) +arglistid([{winnr} [, {tabnr}]]) Return the argument list ID. This is a number which identifies the argument list being used. Zero is used for the global argument list. See |arglist|. @@ -2218,6 +2330,7 @@ arglistid([{winnr}, [ {tabnr} ]]) With {winnr} only use this window in the current tab page. With {winnr} and {tabnr} use the window in the specified tab page. + {winnr} can be the window number or the window ID. *argv()* argv([{nr}]) The result is the {nr}th file in the argument list of the @@ -2260,6 +2373,11 @@ assert_exception({error} [, {msg}]) *assert_exception()* call assert_exception('E492:') endtry +assert_fails({cmd} [, {error}]) *assert_fails()* + Run {cmd} and add an error message to |v:errors| if it does + NOT produce an error. + When {error} is given it must match |v:errmsg|. + assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to |v:errors|, like with |assert_equal()|. @@ -2268,6 +2386,36 @@ assert_false({actual} [, {msg}]) *assert_false()* When {msg} is omitted an error in the form "Expected False but got {actual}" is produced. + *assert_match()* +assert_match({pattern}, {actual} [, {msg}]) + When {pattern} does not match {actual} an error message is + added to |v:errors|. + + {pattern} is used as with |=~|: The matching is always done + like 'magic' was set and 'cpoptions' is empty, no matter what + the actual value of 'magic' or 'cpoptions' is. + + {actual} is used as a string, automatic conversion applies. + Use "^" and "$" to match with the start and end of the text. + Use both to match the whole text. + + When {msg} is omitted an error in the form "Pattern {pattern} + does not match {actual}" is produced. + Example: > + assert_match('^f.*o$', 'foobar') +< Will result in a string to be added to |v:errors|: + test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ + + *assert_notequal()* +assert_notequal({expected}, {actual} [, {msg}]) + The opposite of `assert_equal()`: add an error message to + |v:errors| when {expected} and {actual} are equal. + + *assert_notmatch()* +assert_notmatch({pattern}, {actual} [, {msg}]) + The opposite of `assert_match()`: add an error message to + |v:errors| when {pattern} matches {actual}. + assert_true({actual} [, {msg}]) *assert_true()* When {actual} is not true an error message is added to |v:errors|, like with |assert_equal()|. @@ -2354,8 +2502,6 @@ bufexists({expr}) *bufexists()* for MS-Windows 8.3 names in the form "c:\DOCUME~1" Use "bufexists(0)" to test for the existence of an alternate file name. - *buffer_exists()* - Obsolete name: buffer_exists(). buflisted({expr}) *buflisted()* The result is a Number, which is non-zero if a buffer called @@ -2394,8 +2540,6 @@ bufname({expr}) *bufname()* bufname(3) name of buffer 3 bufname("%") name of current buffer bufname("file2") name of buffer where "file2" matches. -< *buffer_name()* - Obsolete name: buffer_name(). *bufnr()* bufnr({expr} [, {create}]) @@ -2411,10 +2555,16 @@ bufnr({expr} [, {create}]) of existing buffers. Note that not all buffers with a smaller number necessarily exist, because ":bwipeout" may have removed them. Use bufexists() to test for the existence of a buffer. - *buffer_number()* - Obsolete name: buffer_number(). - *last_buffer_nr()* - Obsolete name for bufnr("$"): last_buffer_nr(). + +bufwinid({expr}) *bufwinid()* + The result is a Number, which is the window ID of the first + window associated with buffer {expr}. For the use of {expr}, + see |bufname()| above. If buffer {expr} doesn't exist or + there is no such window, -1 is returned. Example: > + + echo "A window containing buffer 1 is " . (bufwinid(1)) +< + Only deals with the current tab page. bufwinnr({expr}) *bufwinnr()* The result is a Number, which is the number of the first @@ -2452,7 +2602,9 @@ byteidx({expr}, {nr}) *byteidx()* same: > let s = strpart(str, byteidx(str, 3)) echo strpart(s, 0, byteidx(s, 1)) -< If there are less than {nr} characters -1 is returned. +< Also see |strgetchar()| and |strcharpart()|. + + If there are less than {nr} characters -1 is returned. If there are exactly {nr} characters the length of the string in bytes is returned. @@ -2466,8 +2618,6 @@ byteidxcomp({expr}, {nr}) *byteidxcomp()* < The first and third echo result in 3 ('e' plus composing character is 3 bytes), the second echo results in 1 ('e' is one byte). - Only works different from byteidx() when 'encoding' is set to - a Unicode encoding. call({func}, {arglist} [, {dict}]) *call()* *E699* Call function {func} with the items in |List| {arglist} as @@ -2502,11 +2652,11 @@ char2nr({expr}[, {utf8}]) *char2nr()* Return number value of the first char in {expr}. Examples: > char2nr(" ") returns 32 char2nr("ABC") returns 65 -< When {utf8} is omitted or zero, the current 'encoding' is used. - Example for "utf-8": > char2nr("á") returns 225 char2nr("á"[0]) returns 195 -< With {utf8} set to 1, always treat as utf-8 characters. +< Non-ASCII characters are always treated as UTF-8 characters. + {utf8} has no effect, and exists only for + backwards-compatibility. A combining character is a separate character. |nr2char()| does the opposite. @@ -2745,6 +2895,7 @@ cursor({list}) When there is one argument {list} this is used as a |List| with two, three or four item: + [{lnum}, {col}] [{lnum}, {col}, {off}] [{lnum}, {col}, {off}, {curswant}] This is like the return value of |getpos()| or |getcurpos()|, @@ -2811,6 +2962,13 @@ dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* After this is called, every change on {dict} and on keys matching {pattern} will result in {callback} being invoked. + For example, to watch all global variables: > + silent! call dictwatcherdel(g:, '*', 'OnDictChanged') + function! OnDictChanged(d,k,z) + echomsg string(a:k) string(a:z) + endfunction + call dictwatcheradd(g:, '*', 'OnDictChanged') +< For now {pattern} only accepts very simple patterns that can contain a '*' at the end of the string, in which case it will match every key that begins with the substring before the '*'. @@ -2821,7 +2979,7 @@ dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* - The dictionary being watched. - The key which changed. - - A dictionary containg the new and old values for the key. + - A dictionary containing the new and old values for the key. The type of change can be determined by examining the keys present on the third argument: @@ -2920,6 +3078,31 @@ executable({expr}) *executable()* 0 does not exist -1 not implemented on this system +execute({command} [, {silent}]) *execute()* + Execute {command} and capture its output. + If {command} is a |String|, returns {command} output. + If {command} is a |List|, returns concatenated outputs. + Examples: > + echo execute('echon "foo"') +< foo > + echo execute(['echon "foo"', 'echon "bar"']) +< foobar + + The optional {silent} argument can have these values: + "" no `:silent` used + "silent" `:silent` used + "silent!" `:silent!` used + The default is 'silent'. Note that with "silent!", unlike + `:redir`, error messages are dropped. + + To get a list of lines use |split()| on the result: > + split(execute('args'), "\n") + +< This function is not available in the |sandbox|. + Note: If nested, an outer execute() will not observe output of + the inner calls. + Note: Text attributes (highlights) are not captured. + exepath({expr}) *exepath()* If {expr} is an executable and is either an absolute path, a relative path or found in $PATH, return the full path. @@ -3162,6 +3345,18 @@ feedkeys({string} [, {mode}]) *feedkeys()* if coming from a mapping. This matters for undo, opening folds, etc. 'i' Insert the string instead of appending (see above). + 'x' Execute commands until typeahead is empty. This is + similar to using ":normal!". You can call feedkeys() + several times without 'x' and then one time with 'x' + (possibly with an empty {string}) to execute all the + typeahead. Note that when Vim ends in Insert mode it + will behave as if <Esc> is typed, to avoid getting + stuck, waiting for a character to be typed before the + script continues. + '!' When used with 'x' will not end Insert mode. Can be + used in a test when a timer is set to exit Insert mode + a little later. Useful for testing CursorHoldI. + Return value is always 0. filereadable({file}) *filereadable()* @@ -3171,8 +3366,6 @@ filereadable({file}) *filereadable()* expression, which is used as a String. If you don't care about the file being readable you can use |glob()|. - *file_readable()* - Obsolete name: file_readable(). filewritable({file}) *filewritable()* @@ -3359,10 +3552,46 @@ foreground() Move the Vim window to the foreground. Useful when sent from {only in the Win32 GUI and console version} -function({name}) *function()* *E700* + *function()* *E700* *E922* *E923* +function({name} [, {arglist}] [, {dict}]) Return a |Funcref| variable that refers to function {name}. {name} can be a user defined function or an internal function. + When {arglist} or {dict} is present this creates a partial. + That mans the argument list and/or the dictionary is stored in + the Funcref and will be used when the Funcref is called. + + The arguments are passed to the function in front of other + arguments. Example: > + func Callback(arg1, arg2, name) + ... + let Func = function('Callback', ['one', 'two']) + ... + call Func('name') +< Invokes the function as with: > + call Callback('one', 'two', 'name') + +< The Dictionary is only useful when calling a "dict" function. + In that case the {dict} is passed in as "self". Example: > + function Callback() dict + echo "called for " . self.name + endfunction + ... + let context = {"name": "example"} + let Func = function('Callback', context) + ... + call Func() " will echo: called for example + +< The argument list and the Dictionary can be combined: > + function Callback(arg1, count) dict + ... + let context = {"name": "example"} + let Func = function('Callback', ['one'], context) + ... + call Func(500) +< Invokes the function as with: > + call context.Callback('one', 500) + garbagecollect([{atexit}]) *garbagecollect()* Cleanup unused |Lists| and |Dictionaries| that have circular @@ -3386,7 +3615,68 @@ get({dict}, {key} [, {default}]) Get item with key {key} from |Dictionary| {dict}. When this item is not available return {default}. Return zero when {default} is omitted. +get({func}, {what}) + Get item {what} from Funcref {func}. Possible values for + {what} are: + 'name' The function name + 'func' The function + 'dict' The dictionary + 'args' The list with arguments + + *getbufinfo()* +getbufinfo([{expr}]) +getbufinfo([{dict}]) + Get information about buffers as a List of Dictionaries. + + Without an argument information about all the buffers is + returned. + + When the argument is a Dictionary only the buffers matching + the specified criteria are returned. The following keys can + be specified in {dict}: + buflisted include only listed buffers. + bufloaded include only loaded buffers. + + Otherwise, {expr} specifies a particular buffer to return + information for. For the use of {expr}, see |bufname()| + above. If the buffer is found the returned List has one item. + Otherwise the result is an empty list. + + Each returned List item is a dictionary with the following + entries: + bufnr buffer number. + changed TRUE if the buffer is modified. + changedtick number of changes made to the buffer. + hidden TRUE if the buffer is hidden. + listed TRUE if the buffer is listed. + lnum current line number in buffer. + loaded TRUE if the buffer is loaded. + name full path to the file in the buffer. + signs list of signs placed in the buffer. + Each list item is a dictionary with + the following fields: + id sign identifier + lnum line number + name sign name + variables a reference to the dictionary with + buffer-local variables. + windows list of |window-ID|s that display this + buffer + Examples: > + for buf in getbufinfo() + echo buf.name + endfor + for buf in getbufinfo({'buflisted':1}) + if buf.changed + .... + endif + endfor +< + To get buffer-local options use: > + getbufvar({bufnr}, '&') + +< *getbufline()* getbufline({expr}, {lnum} [, {end}]) Return a |List| with the lines starting from {lnum} to {end} @@ -3418,6 +3708,10 @@ getbufvar({expr}, {varname} [, {def}]) *getbufvar()* must be used. When {varname} is empty returns a dictionary with all the buffer-local variables. + When {varname} is equal to "&" returns a dictionary with all + the buffer-local options. + Otherwise, when {varname} starts with "&" returns the value of + a buffer-local option. This also works for a global or buffer-local option, but it doesn't work for a global variable, window-local variable or window-local option. @@ -3458,8 +3752,8 @@ getchar([expr]) *getchar()* When the user clicks a mouse button, the mouse event will be returned. The position can then be found in |v:mouse_col|, - |v:mouse_lnum| and |v:mouse_win|. This example positions the - mouse as it would normally happen: > + |v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. This + example positions the mouse as it would normally happen: > let c = getchar() if c == "\<LeftMouse>" && v:mouse_win > 0 exe v:mouse_win . "wincmd w" @@ -3570,10 +3864,57 @@ getcmdwintype() *getcmdwintype()* values are the same as |getcmdtype()|. Returns an empty string when not in the command-line window. +getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* + Return a list of command-line completion matches. {type} + specifies what for. The following completion types are + supported: + + augroup autocmd groups + buffer buffer names + behave :behave suboptions + color color schemes + command Ex command (and arguments) + compiler compilers + cscope |:cscope| suboptions + dir directory names + environment environment variable names + event autocommand events + expression Vim expression + file file and directory names + file_in_path file and directory names in |'path'| + filetype filetype names |'filetype'| + function function name + help help subjects + highlight highlight groups + history :history suboptions + locale locale names (as output of locale -a) + mapping mapping name + menu menus + option options + shellcmd Shell command + sign |:sign| suboptions + syntax syntax file names |'syntax'| + syntime |:syntime| suboptions + tag tags + tag_listfiles tags, file names + user user names + var user variables + + If {pat} is an empty string, then all the matches are returned. + Otherwise only items matching {pat} are returned. See + |wildcards| for the use of special characters in {pat}. + + If the optional {filtered} flag is set to 1, then 'wildignore' + is applied to filter the results. Otherwise all the matches + are returned. The 'wildignorecase' option always applies. + + If there are no matches, an empty list is returned. An + invalid value for {type} produces an error. + *getcurpos()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra item in the list: - [bufnum, lnum, col, off, curswant] + [bufnum, lnum, col, off, curswant] ~ The "curswant" number is the preferred column when moving the cursor vertically. This can be used to save and restore the cursor position: > @@ -3581,17 +3922,18 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but MoveTheCursorAround call setpos('.', save_cursor) < -getcwd([{window}[, {tab}]]) *getcwd()* +getcwd([{winnr}[, {tabnr}]]) *getcwd()* With no arguments the result is a String, which is the name of - the current effective working directory. With {window} or - {tab} the working directory of that scope is returned. + the current effective working directory. With {winnr} or + {tabnr} the working directory of that scope is returned. Tabs and windows are identified by their respective numbers, 0 means current tab or window. Missing argument implies 0. Thus the following are equivalent: > getcwd() getcwd(0) getcwd(0, 0) -< If {window} is -1 it is ignored, only the tab is resolved. +< If {winnr} is -1 it is ignored, only the tab is resolved. + {winnr} can be the window number or the window ID. getfsize({fname}) *getfsize()* @@ -3656,7 +3998,8 @@ getftype({fname}) *getftype()* getftype("/home") < Note that a type such as "link" will only be returned on systems that support it. On some systems only "dir" and - "file" are returned. + "file" are returned. On MS-Windows a symbolic link to a + directory returns "dir" instead of "link". *getline()* getline({lnum} [, {end}]) @@ -3685,7 +4028,9 @@ getline({lnum} [, {end}]) getloclist({nr}) *getloclist()* Returns a list with all the entries in the location list for - window {nr}. When {nr} is zero the current window is used. + window {nr}. {nr} can be the window number or the window ID. + When {nr} is zero the current window is used. + For a location list window, the displayed location list is returned. For an invalid window number {nr}, an empty list is returned. Otherwise, same as |getqflist()|. @@ -3770,16 +4115,21 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()* The result is a String, which is the contents of register {regname}. Example: > :let cliptext = getreg('*') -< getreg('=') returns the last evaluated value of the expression +< When {regname} was not set the result is a empty string. + + getreg('=') returns the last evaluated value of the expression register. (For use in maps.) getreg('=', 1) returns the expression itself, so that it can be restored with |setreg()|. For other registers the extra argument is ignored, thus you can always give it. - If {list} is present and non-zero result type is changed to - |List|. Each list item is one text line. Use it if you care + + If {list} is present and non-zero, the result type is changed + to |List|. Each list item is one text line. Use it if you care about zero bytes possibly present inside register: without third argument both NLs and zero bytes are represented as NLs (see |NL-used-for-Nul|). + When the register was not set an empty list is returned. + If {regname} is not specified, |v:register| is used. @@ -3793,6 +4143,19 @@ getregtype([{regname}]) *getregtype()* <CTRL-V> is one character with value 0x16. If {regname} is not specified, |v:register| is used. +gettabinfo([{arg}]) *gettabinfo()* + If {arg} is not specified, then information about all the tab + pages is returned as a List. Each List item is a Dictionary. + Otherwise, {arg} specifies the tab page number and information + about that one is returned. If the tab page does not exist an + empty List is returned. + + Each List item is a Dictionary with the following entries: + nr tab page number. + variables a reference to the dictionary with + tabpage-local variables + windows List of window IDs in the tag page. + gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page {tabnr}. |t:var| @@ -3806,13 +4169,16 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Get the value of window-local variable {varname} in window {winnr} in tab page {tabnr}. - When {varname} starts with "&" get the value of a window-local - option. When {varname} is empty a dictionary with all window-local variables is returned. + When {varname} is equal to "&" get the values of all + window-local options in a Dictionary. + Otherwise, when {varname} starts with "&" get the value of a + window-local option. Note that {varname} must be the name without "w:". Tabs are numbered starting with one. For the current tabpage use |getwinvar()|. + {winnr} can be the window number or the window ID. When {winnr} is zero the current window is used. This also works for a global option, buffer-local option and window-local option, but it doesn't work for a global variable @@ -3833,6 +4199,31 @@ getwinposy() The result is a Number, which is the Y coordinate in pixels of the top of the GUI Vim window. The result will be -1 if the information is not available. +getwininfo([{winid}]) *getwininfo()* + Returns information about windows as a List with Dictionaries. + + If {winid} is given Information about the window with that ID + is returned. If the window does not exist the result is an + empty list. + + Without an information about all the windows in all the tab + pages is returned. + + Each List item is a Dictionary with the following entries: + bufnum number of buffer in the window + height window height + loclist 1 if showing a location list + nr window number + quickfix 1 if quickfix or location list window + tpnr tab page number + variables a reference to the dictionary with + window-local variables + width window width + winid window ID + + To obtain all window-local variables use: > + gettabwinvar({tabnr}, {winnr}, '&') + getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* Like |gettabwinvar()| for the current tabpage. Examples: > @@ -3929,7 +4320,7 @@ has_key({dict}, {key}) *has_key()* The result is a Number, which is 1 if |Dictionary| {dict} has an entry with key {key}. Zero otherwise. -haslocaldir([{window}[, {tab}]]) *haslocaldir()* +haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()* The result is a Number, which is 1 when the specified tabpage or window has a local path set via |:lcd| or |:tcd|, and 0 otherwise. @@ -3940,7 +4331,8 @@ haslocaldir([{window}[, {tab}]]) *haslocaldir()* haslocaldir() haslocaldir(0) haslocaldir(0, 0) -< If {window} is -1 it is ignored, only the tab is resolved. +< {winnr} can be the window number or the window ID. + If {winnr} is -1 it is ignored, only the tab is resolved. hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* The result is a Number, which is 1 if there is a mapping that @@ -4051,8 +4443,6 @@ hlexists({name}) *hlexists()* defined in some way. Not necessarily when highlighting has been defined for it, it may also have been used for a syntax item. - *highlight_exists()* - Obsolete name: highlight_exists(). *hlID()* hlID({name}) The result is a Number, which is the ID of the highlight group @@ -4062,8 +4452,6 @@ hlID({name}) The result is a Number, which is the ID of the highlight group group. For example, to get the background color of the "Comment" group: > :echo synIDattr(synIDtrans(hlID("Comment")), "bg") -< *highlightID()* - Obsolete name: highlightID(). hostname() *hostname()* The result is a String, which is the name of the machine on @@ -4081,11 +4469,7 @@ iconv({expr}, {from}, {to}) *iconv()* Most conversions require Vim to be compiled with the |+iconv| feature. Otherwise only UTF-8 to latin1 conversion and back can be done. - This can be used to display messages with special characters, - no matter what 'encoding' is set to. Write the message in - UTF-8 and use: > - echo iconv(utf8_str, "utf-8", &enc) -< Note that Vim uses UTF-8 for all Unicode encodings, conversion + Note that Vim uses UTF-8 for all Unicode encodings, conversion from/to UCS-2 is automatically changed to use UTF-8. You cannot use UCS-2 in a string anyway, because of the NUL bytes. {only available when compiled with the |+multi_byte| feature} @@ -4259,8 +4643,11 @@ items({dict}) *items()* order. jobclose({job}[, {stream}]) {Nvim} *jobclose()* - Close {job}'s {stream}, which can be one "stdin", "stdout" or - "stderr". If {stream} is omitted, all streams are closed. + Close {job}'s {stream}, which can be one of "stdin", "stdout", + "stderr" or "rpc" (closes the rpc channel for a job started + with the "rpc" option.) If {stream} is omitted, all streams + are closed. If the job is a pty job, this will then close the + pty master, sending SIGHUP to the job process. jobpid({job}) {Nvim} *jobpid()* Return the pid (process id) of {job}. @@ -4282,42 +4669,55 @@ jobsend({job}, {data}) {Nvim} *jobsend()* :call jobsend(j, ["abc", "123\n456", ""]) < will send "abc<NL>123<NUL>456<NL>". + If the job was started with the rpc option this function + cannot be used, instead use |rpcnotify()| and |rpcrequest()| + to communicate with the job. + jobstart({cmd}[, {opts}]) {Nvim} *jobstart()* - Spawns {cmd} as a job. If {cmd} is a |List|, it will be run - directly. If {cmd} is a |string|, it will be roughly - equivalent to > - :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}']) -< NOTE: read |shell-unquoting| before constructing any lists - with 'shell' or 'shellcmdflag' options. The above call is - only written to show the idea, one needs to perform unquoting - and do split taking quotes into account. - If passed, {opts} must be a dictionary with any of the - following keys: - - on_stdout: stdout event handler - - on_stderr: stderr event handler - - on_exit: exit event handler - - pty: If set, the job will be connected to a new pseudo - terminal, and the job streams are connected to the master - file descriptor. - - width: Width of the terminal screen(only if pty is set) - - height: Height of the terminal screen(only if pty is set) - - TERM: $TERM environment variable(only if pty is set) - - detach: Detach the job process from the nvim process. The - process won't get killed when nvim exists. If the process - dies before nvim exits, on_exit will still be invoked. - This option is only allowed for non-pty jobs. - Either funcrefs or function names can be passed as event - handlers. The {opts} object is also used as the "self" - argument for the callback, so the caller may pass arbitrary - data by setting other key.(see |Dictionary-function| for more - information). + Spawns {cmd} as a job. If {cmd} is a |List| it is run + directly. If {cmd} is a |String| it is processed like this: > + :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}']) +< NOTE: This only shows the idea; see |shell-unquoting| before + constructing lists with 'shell' or 'shellcmdflag'. + + NOTE: On Windows if {cmd} is a List, cmd[0] must be a valid + executable (.exe, .com). If the executable is in $PATH it can + be called by name, with or without an extension: > + :call jobstart(['ping', 'neovim.io']) +< If it is a path (not a name), it must include the extension: > + :call jobstart(['System32\ping.exe', 'neovim.io']) +< + {opts} is a dictionary with these keys: + on_stdout: stdout event handler (function name or |Funcref|) + on_stderr: stderr event handler (function name or |Funcref|) + on_exit : exit event handler (function name or |Funcref|) + cwd : Working directory of the job; defaults to + |current-directory|. + rpc : If set, |msgpack-rpc| will be used to communicate + with the job over stdin and stdout. "on_stdout" is + then ignored, but "on_stderr" can still be used. + pty : If set, the job will be connected to a new pseudo + terminal, and the job streams are connected to + the master file descriptor. "on_stderr" is ignored + as all output will be received on stdout. + + width : (pty only) Width of the terminal screen + height : (pty only) Height of the terminal screen + TERM : (pty only) $TERM environment variable + detach : (non-pty only) Detach the job process from the + nvim process. The process will not get killed + when nvim exits. If the process dies before + nvim exits, on_exit will still be invoked. + + {opts} is passed as |self| to the callback; the caller may + pass arbitrary data by setting other keys. Returns: - - The job ID on success, which is used by |jobsend()| and - |jobstop()| - - 0 when the job table is full or on invalid arguments - - -1 when {cmd}[0] is not executable. Will never fail if - {cmd} is a string unless 'shell' is not executable. - See |job-control| for more information. + - The job ID on success, which is used by |jobsend()| (or + |rpcnotify()| and |rpcrequest()| if "rpc" option was used) + and |jobstop()| + - 0 on invalid arguments or if the job table is full + - -1 if {cmd}[0] is not executable. + See |job-control| and |msgpack-rpc| for more information. jobstop({job}) {Nvim} *jobstop()* Stop a job created with |jobstart()| by sending a `SIGTERM` @@ -4359,9 +4759,7 @@ join({list} [, {sep}]) *join()* json_decode({expr}) *json_decode()* Convert {expr} from JSON object. Accepts |readfile()|-style list as the input, as well as regular string. May output any - Vim value. When 'encoding' is not UTF-8 string is converted - from UTF-8 to 'encoding', failing conversion fails - json_decode(). In the following cases it will output + Vim value. In the following cases it will output |msgpack-special-dict|: 1. Dictionary contains duplicate key. 2. Dictionary contains empty key. @@ -4369,33 +4767,22 @@ json_decode({expr}) *json_decode()* dictionary and for string will be emitted in case string with NUL byte was a dictionary key. - Note: function treats its input as UTF-8 always regardless of - 'encoding' value. This is needed because JSON source is - supposed to be external (e.g. |readfile()|) and JSON standard - allows only a few encodings, of which UTF-8 is recommended and - the only one required to be supported. Non-UTF-8 characters - are an error. + Note: function treats its input as UTF-8 always. The JSON + standard allows only a few encodings, of which UTF-8 is + recommended and the only one required to be supported. + Non-UTF-8 characters are an error. json_encode({expr}) *json_encode()* Convert {expr} into a JSON string. Accepts - |msgpack-special-dict| as the input. Converts from 'encoding' - to UTF-8 when encoding strings. Will not convert |Funcref|s, + |msgpack-special-dict| as the input. Will not convert |Funcref|s, mappings with non-string keys (can be created as |msgpack-special-dict|), values with self-referencing containers, strings which contain non-UTF-8 characters, pseudo-UTF-8 strings which contain codepoints reserved for surrogate pairs (such strings are not valid UTF-8 strings). - When converting 'encoding' is taken into account, if it is not - "utf-8", then conversion is performed before encoding strings. Non-printable characters are converted into "\u1234" escapes or special escapes like "\t", other are dumped as-is. - Note: all characters above U+0079 are considered non-printable - when 'encoding' is not UTF-8. This function always outputs - UTF-8 strings as required by the standard thus when 'encoding' - is not unicode resulting string will look incorrect if - "\u1234" notation is not used. - keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in arbitrary order. @@ -4497,9 +4884,9 @@ line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line {lnum}. This includes the end-of-line character, depending on the 'fileformat' option for the current buffer. The first - line returns 1. 'encoding' matters, 'fileencoding' is ignored. - This can also be used to get the byte count for the line just - below the last line: > + line returns 1. UTF-8 encoding is used, 'fileencoding' is + ignored. This can also be used to get the byte count for the + line just below the last line: > line2byte(line("$") + 1) < This is the buffer size plus one. If 'fileencoding' is empty it is the file size plus one. @@ -4737,8 +5124,8 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]]) respectively. If the {id} argument is not specified or -1, |matchadd()| automatically chooses a free ID. - The optional {dict} argmument allows for further custom - values. Currently this is used to specify a match specifc + The optional {dict} argument allows for further custom + values. Currently this is used to specify a match specific conceal character that will be shown for |hl-Conceal| highlighted matches. The dict can have the following members: @@ -4854,6 +5241,24 @@ matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* When {expr} is a |List| then the matching item is returned. The type isn't changed, it's not necessarily a String. +matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()* + Same as |matchstr()|, but return the matched string, the start + position and the end position of the match. Example: > + :echo matchstrpos("testing", "ing") +< results in ["ing", 4, 7]. + When there is no match ["", -1, -1] is returned. + The {start}, if given, has the same meaning as for |match()|. > + :echo matchstrpos("testing", "ing", 2) +< results in ["ing", 4, 7]. > + :echo matchstrpos("testing", "ing", 5) +< result is ["", -1, -1]. + When {expr} is a |List| then the matching item, the index + of first item where {pat} matches, the start position and the + end position of the match are returned. > + :echo matchstrpos([1, '__x'], '\a') +< result is ["x", 1, 2, 3]. + The type isn't changed, it's not necessarily a String. + *max()* max({list}) Return the maximum value of all items in {list}. If {list} is not a list or one of the items in {list} cannot @@ -4923,7 +5328,7 @@ msgpackdump({list}) {Nvim} *msgpackdump()* (dictionary with zero items is represented by 0x80 byte in messagepack). - Limitations: *E951* *E952* *E953* + Limitations: *E5004* *E5005* 1. |Funcref|s cannot be dumped. 2. Containers that reference themselves cannot be dumped. 3. Dictionary keys are always dumped as STR strings. @@ -5018,15 +5423,26 @@ nr2char({expr}[, {utf8}]) *nr2char()* value {expr}. Examples: > nr2char(64) returns "@" nr2char(32) returns " " -< When {utf8} is omitted or zero, the current 'encoding' is used. - Example for "utf-8": > +< Example for "utf-8": > nr2char(300) returns I with bow character -< With {utf8} set to 1, always return utf-8 characters. +< UTF-8 encoding is always used, {utf8} option has no effect, + and exists only for backwards-compatibility. Note that a NUL character in the file is specified with nr2char(10), because NULs are represented with newline characters. nr2char(0) is a real NUL and terminates the string, thus results in an empty string. +nvim_...({...}) *nvim_...()* *eval-api* + Call nvim |api| functions. The type checking of arguments will + be stricter than for most other builtins. For instance, + if Integer is expected, a |Number| must be passed in, a + |String| will not be autoconverted. + Buffer numbers, as returned by |bufnr()| could be used as + first argument to nvim_buf_... functions. All functions + expecting an object (buffer, window or tabpage) can + also take the numerical value 0 to indicate the current + (focused) object. + or({expr}, {expr}) *or()* Bitwise OR on the two arguments. The arguments are converted to a number. A List, Dict or Float argument causes an error. @@ -5180,6 +5596,16 @@ printf({fmt}, {expr1} ...) *printf()* numeric field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result. + The 'h' modifier indicates the argument is 16 bits. + The 'l' modifier indicates the argument is 32 bits. + The 'L' modifier indicates the argument is 64 bits. + Generally, these modifiers are not useful. They are + ignored when type is known from the argument. + + i alias for d + D alias for ld + U alias for lu + O alias for lo *printf-c* c The Number argument is converted to a byte, and the @@ -5196,7 +5622,7 @@ printf({fmt}, {expr1} ...) *printf()* feature works just like 's'. *printf-f* *E807* - f The Float argument is converted into a string of the + f F The Float argument is converted into a string of the form 123.456. The precision specifies the number of digits after the decimal point. When the precision is zero the decimal point is omitted. When the precision @@ -5246,13 +5672,12 @@ pumvisible() *pumvisible()* This can be used to avoid some things that would remove the popup menu. - *E860* py3eval({expr}) *py3eval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. Numbers and strings are returned as they are (strings are copied though, Unicode strings are additionally converted to - 'encoding'). + UTF-8). Lists are represented as Vim |List| type. Dictionaries are represented as Vim |Dictionary| type with keys converted to strings. @@ -5302,8 +5727,7 @@ readfile({fname} [, {binary} [, {max}]]) Otherwise: - CR characters that appear before a NL are removed. - Whether the last line ends in a NL or not does not matter. - - When 'encoding' is Unicode any UTF-8 byte order mark is - removed from the text. + - Any UTF-8 byte order mark is removed from the text. When {max} is given this specifies the maximum number of lines to be read. Useful if you only want to check the first ten lines of a file: > @@ -5325,14 +5749,20 @@ reltime([{start} [, {end}]]) *reltime()* the item depends on the system. It can be passed to |reltimestr()| to convert it to a string or |reltimefloat()| to convert to a float. - Without an argument it returns the current time. - With one argument is returns the time passed since the time + + Without an argument it returns the current "relative time", an + implementation-defined value meaningful only when used as an + argument to |reltime()|, |reltimestr()| and |reltimefloat()|. + + With one argument it returns the time passed since the time specified in the argument. With two arguments it returns the time passed between {start} and {end}. The {start} and {end} arguments must be values returned by reltime(). + Note: |localtime()| returns the current (non-relative) time. + reltimefloat({time}) *reltimefloat()* Return a Float that represents the time value of {time}. Unit of time is seconds. @@ -5504,31 +5934,31 @@ round({expr}) *round()* < -5.0 rpcnotify({channel}, {event}[, {args}...]) {Nvim} *rpcnotify()* - Sends {event} to {channel} via |msgpack-rpc| and returns - immediately. If {channel} is 0, the event is broadcast to all - channels. Example: > + Sends {event} to {channel} via |RPC| and returns immediately. + If {channel} is 0, the event is broadcast to all channels. + Example: > :au VimLeave call rpcnotify(0, "leaving") rpcrequest({channel}, {method}[, {args}...]) {Nvim} *rpcrequest()* Sends a request to {channel} to invoke {method} via - |msgpack-rpc| and blocks until a response is received. + |RPC| and blocks until a response is received. Example: > :let result = rpcrequest(rpc_chan, "func", 1, 2, 3) rpcstart({prog}[, {argv}]) {Nvim} *rpcstart()* - Spawns {prog} as a job (optionally passing the list {argv}), - and opens a |msgpack-rpc| channel with the spawned process's - stdin/stdout. It returns: - - The channel id on success, which is used by |rpcrequest()|, - |rpcnotify()| and |rpcstop()| - - 0 on failure. - Example: > - :let rpc_chan = rpcstart('prog', ['arg1', 'arg2']) + Deprecated. Replace > + :let id = rpcstart('prog', ['arg1', 'arg2']) +< with > + :let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true}) rpcstop({channel}) {Nvim} *rpcstop()* - Closes a |msgpack-rpc| {channel}, possibly created via - |rpcstart()|. Also closes channels created by connections to - |$NVIM_LISTEN_ADDRESS|. + Closes an |RPC| {channel}. If the channel is a job + started with |jobstart()| the job is killed. + It is better to use |jobstop()| in this case, or use + |jobclose|(id, "rpc") to only close the channel without + killing the job. + Closes the socket connection if the channel was opened by + connecting to |v:servername|. screenattr(row, col) *screenattr()* Like screenchar(), but return the attribute. This is a rather @@ -5591,7 +6021,7 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* 'ignorecase', 'smartcase' and 'magic' are used. - When the 'z' flag is not given seaching always starts in + When the 'z' flag is not given, searching always starts in column zero and then matches before the cursor are skipped. When the 'c' flag is present in 'cpo' the next search starts after the match. Without the 'c' flag the next search starts @@ -5906,11 +6336,13 @@ setline({lnum}, {text}) *setline()* setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()* Create or replace or add to the location list for window {nr}. - When {nr} is zero the current window is used. For a location - list window, the displayed location list is modified. For an - invalid window number {nr}, -1 is returned. If {title} is - given, it will be used to set |w:quickfix_title| after opening - the location window. + {nr} can be the window number or the window ID. + When {nr} is zero the current window is used. + + For a location list window, the displayed location list is + modified. For an invalid window number {nr}, -1 is returned. If + {title} is given, it will be used to set |w:quickfix_title| + after opening the location window. Otherwise, same as |setqflist()|. Also see |location-list|. @@ -5999,12 +6431,18 @@ setqflist({list} [, {action}[, {title}]]) *setqflist()* Note that the list is not exactly the same as what |getqflist()| returns. + *E927* If {action} is set to 'a', then the items from {list} are added to the existing quickfix list. If there is no existing - list, then a new list is created. If {action} is set to 'r', - then the items from the current quickfix list are replaced - with the items from {list}. If {action} is not present or is - set to ' ', then a new list is created. + list, then a new list is created. + + If {action} is set to 'r', then the items from the current + quickfix list are replaced with the items from {list}. This + can also be used to clear the list: > + :call setqflist([], 'r') +< + If {action} is not present or is set to ' ', then a new list + is created. If {title} is given, it will be used to set |w:quickfix_title| after opening the quickfix window. @@ -6017,7 +6455,7 @@ setqflist({list} [, {action}[, {title}]]) *setqflist()* *setreg()* -setreg({regname}, {value} [,{options}]) +setreg({regname}, {value} [, {options}]) Set the register {regname} to {value}. {value} may be any value returned by |getreg()|, including a |List|. @@ -6074,6 +6512,7 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* {val}. Tabs are numbered starting with one. For the current tabpage use |setwinvar()|. + {winnr} can be the window number or the window ID. When {winnr} is zero the current window is used. This also works for a global or local buffer option, but it doesn't work for a global or local buffer variable. @@ -6198,6 +6637,9 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* sorted numerical. This is like 'n' but a string containing digits will be used as the number they represent. + When {func} is given and it is 'f' then all items will be + sorted numerical. All values must be a Number or a Float. + When {func} is a |Funcref| or a function name, this function is called to compare items. The function is invoked with two items as argument and must return zero if they are equal, 1 or @@ -6355,7 +6797,6 @@ strchars({expr} [, {skipcc}]) *strchars()* counted separately. When {skipcc} set to 1, Composing characters are ignored. Also see |strlen()|, |strdisplaywidth()| and |strwidth()|. - {skipcc} is only available after 7.4.755. For backward compatibility, you can define a wrapper function: > @@ -6373,6 +6814,13 @@ strchars({expr} [, {skipcc}]) *strchars()* endfunction endif < +strcharpart({src}, {start}[, {len}]) *strcharpart()* + Like |strpart()| but using character index and length instead + of byte index and length. + When a character index is used where a character does not + exist it is assumed to be one byte. For example: > + strcharpart('abc', -1, 2) +< results in 'a'. strdisplaywidth({expr}[, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells @@ -6406,6 +6854,12 @@ strftime({format} [, {time}]) *strftime()* < Not available on all systems. To check use: > :if exists("*strftime") +strgetchar({str}, {index}) *strgetchar()* + Get character {index} from {str}. This uses a character + index, not a byte index. Composing characters are considered + separate characters here. + Also see |strcharpart()| and |strchars()|. + stridx({haystack}, {needle} [, {start}]) *stridx()* The result is a Number, which gives the byte index in {haystack} of the first occurrence of the String {needle}. @@ -6443,8 +6897,7 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number, for infinite and NaN floating-point values representations which use |str2float()|. Strings are also dumped literally, only single quote is escaped, which does not allow using YAML - for parsing back binary strings (including text when - 'encoding' is not UTF-8). |eval()| should always work for + for parsing back binary strings. |eval()| should always work for strings and floats though and this is the only official method, use |msgpackdump()| or |json_encode()| if you need to share data with other application. @@ -6461,14 +6914,17 @@ strlen({expr}) The result is a Number, which is the length of the String strpart({src}, {start}[, {len}]) *strpart()* The result is a String, which is part of {src}, starting from byte {start}, with the byte length {len}. - When non-existing bytes are included, this doesn't result in - an error, the bytes are simply omitted. + To count characters instead of bytes use |strcharpart()|. + + When bytes are selected which do not exist, this doesn't + result in an error, the bytes are simply omitted. If {len} is missing, the copy continues from {start} till the end of the {src}. > strpart("abcdefg", 3, 2) == "de" strpart("abcdefg", -2, 4) == "ab" strpart("abcdefg", 5, 4) == "fg" strpart("abcdefg", 3) == "defg" + < Note: To get the first character, {start} must be 0. For example, to get three bytes under and after the cursor: > strpart(getline("."), col(".") - 1, 3) @@ -6574,9 +7030,9 @@ synID({lnum}, {col}, {trans}) *synID()* that's where the cursor can be in Insert mode, synID() returns zero. - When {trans} is non-zero, transparent items are reduced to the + When {trans} is |TRUE|, transparent items are reduced to the item that they reveal. This is useful when wanting to know - the effective color. When {trans} is zero, the transparent + the effective color. When {trans} is |FALSE|, the transparent item is returned. This is useful when wanting to know which syntax item is effective (e.g. inside parens). Warning: This function can be very slow. Best speed is @@ -6659,26 +7115,32 @@ synstack({lnum}, {col}) *synstack()* valid positions. system({cmd} [, {input}]) *system()* *E677* - Get the output of the shell command {cmd} as a |string|. {cmd} - will be run the same as in |jobstart()|. See |systemlist()| - to get the output as a |List|. - - When {input} is given and is a string this string is written - to a file and passed as stdin to the command. The string is - written as-is, you need to take care of using the correct line - separators yourself. - If {input} is given and is a |List| it is written to the file - in a way |writefile()| does with {binary} set to "b" (i.e. - with a newline between each list item with newlines inside - list items converted to NULs). - Pipes are not used. + Get the output of {cmd} as a |string| (use |systemlist()| to + get a |List|). {cmd} is treated exactly as in |jobstart()|. + Not to be used for interactive commands. + + If {input} is a string it is written to a pipe and passed as + stdin to the command. The string is written as-is, line + separators are not changed. + If {input} is a |List| it is written to the pipe as + |writefile()| does with {binary} set to "b" (i.e. with + a newline between each list item, and newlines inside list + items converted to NULs). + *E5677* + Note: system() cannot write to or read from backgrounded ("&") + shell commands, e.g.: > + :echo system("cat - &", "foo")) +< which is equivalent to: > + $ echo foo | bash -c 'cat - &' +< The pipes are disconnected (unless overridden by shell + redirection syntax) before input can reach it. Use + |jobstart()| instead. Note: Use |shellescape()| or |::S| with |expand()| or |fnamemodify()| to escape special characters in a command argument. Newlines in {cmd} may cause the command to fail. The characters in 'shellquote' and 'shellxquote' may also cause trouble. - This is not to be used for interactive commands. The result is a String. Example: > :let files = system("ls " . shellescape(expand('%:h'))) @@ -6693,9 +7155,6 @@ system({cmd} [, {input}]) *system()* *E677* The command executed is constructed using several options when {cmd} is a string: 'shell' 'shellcmdflag' {cmd} - The command will be executed in "cooked" mode, so that a - CTRL-C will interrupt the command (on Unix at least). - The resulting error code can be found in |v:shell_error|. This function will fail in |restricted-mode|. @@ -6816,7 +7275,7 @@ termopen({cmd}[, {opts}]) {Nvim} *termopen()* and `$TERM` is set to "xterm-256color". Returns the same values as |jobstart()|. - See |nvim-terminal-emulator| for more information. + See |terminal-emulator| for more information. tan({expr}) *tan()* Return the tangent of {expr}, measured in radians, as a |Float| @@ -6840,6 +7299,38 @@ tanh({expr}) *tanh()* < -0.761594 + *timer_start()* +timer_start({time}, {callback} [, {options}]) + Create a timer and return the timer ID. + + {time} is the waiting time in milliseconds. This is the + minimum time before invoking the callback. When the system is + busy or Vim is not waiting for input the time will be longer. + + {callback} is the function to call. It can be the name of a + function or a Funcref. It is called with one argument, which + is the timer ID. The callback is only invoked when Vim is + waiting for input. + + {options} is a dictionary. Supported entries: + "repeat" Number of times to repeat calling the + callback. -1 means forever. + + Example: > + func MyHandler(timer) + echo 'Handler called' + endfunc + let timer = timer_start(500, 'MyHandler', + \ {'repeat': 3}) +< This will invoke MyHandler() three times at 500 msec + intervals. + {only available when compiled with the |+timers| feature} + +timer_stop({timer}) *timer_stop()* + Stop a timer. The timer callback will no longer be invoked. + {timer} is an ID returned by timer_start(), thus it must be a + Number. + tolower({expr}) *tolower()* The result is a copy of the String given, with all uppercase characters turned into lowercase (just like applying |gu| to @@ -7039,11 +7530,40 @@ wildmenumode() *wildmenumode()* (Note, this needs the 'wildcharm' option set appropriately). +win_findbuf({bufnr}) *win_findbuf()* + Returns a list with window IDs for windows that contain buffer + {bufnr}. When there is none the list is empty. + +win_getid([{win} [, {tab}]]) *win_getid()* + Get the window ID for the specified window. + When {win} is missing use the current window. + With {win} this is the window number. The top window has + number 1. + Without {tab} use the current tab, otherwise the tab with + number {tab}. The first tab has number one. + Return zero if the window cannot be found. + +win_gotoid({expr}) *win_gotoid()* + Go to window with ID {expr}. This may also change the current + tabpage. + Return 1 if successful, 0 if the window cannot be found. + +win_id2tabwin({expr} *win_id2tabwin()* + Return a list with the tab number and window number of window + with ID {expr}: [tabnr, winnr]. + Return [0, 0] if the window cannot be found. + +win_id2win({expr}) *win_id2win()* + Return the window number of window with ID {expr}. + Return 0 if the window cannot be found in the current tabpage. + *winbufnr()* winbufnr({nr}) The result is a Number, which is the number of the buffer - associated with window {nr}. When {nr} is zero, the number of - the buffer in the current window is returned. When window - {nr} doesn't exist, -1 is returned. + associated with window {nr}. {nr} can be the window number or + the window ID. + When {nr} is zero, the number of the buffer in the current + window is returned. + When window {nr} doesn't exist, -1 is returned. Example: > :echo "The file in the current window is " . bufname(winbufnr(0)) < @@ -7054,6 +7574,7 @@ wincol() The result is a Number, which is the virtual column of the winheight({nr}) *winheight()* The result is a Number, which is the height of window {nr}. + {nr} can be the window number or the window ID. When {nr} is zero, the height of the current window is returned. When window {nr} doesn't exist, -1 is returned. An existing window always has a height of zero or more. @@ -7133,6 +7654,7 @@ winsaveview() Returns a |Dictionary| that contains information to restore winwidth({nr}) *winwidth()* The result is a Number, which is the width of window {nr}. + {nr} can be the window number or the window ID. When {nr} is zero, the width of the current window is returned. When window {nr} doesn't exist, -1 is returned. An existing window always has a width of zero or more. @@ -7208,7 +7730,11 @@ There are four types of features: Example: > :if has("gui_running") < *has-patch* -3. Included patches. The "patch123" feature means that patch 123 has been +3. {Nvim} version. The "nvim-1.2.3" feature means that the Nvim version is + 1.2.3 or later. Example: > + :if has("nvim-1.2.3") +< +4. Included patches. The "patch123" feature means that patch 123 has been included. Note that this form does not check the version of Vim, you need to inspect |v:version| for that. Example (checking version 6.2.148 or later): > @@ -7216,7 +7742,7 @@ There are four types of features: < Note that it's possible for patch 147 to be omitted even though 148 is included. -4. Beyond a certain version or at a certain version and including a specific +5. Beyond a certain version or at a certain version and including a specific patch. The "patch-7.4.237" feature means that the Vim version is 7.5 or later, or it is version 7.4 and patch 237 was included. Note that this only works for patch 7.4.237 and later, before that you @@ -7247,7 +7773,7 @@ dialog_gui Compiled with GUI dialog support. digraphs Compiled with support for digraphs. eval Compiled with expression evaluation support. Always true, of course! -ex_extra Compiled with extra Ex commands |+ex_extra|. +ex_extra |+ex_extra|, always true now extra_search Compiled with support for |'incsearch'| and |'hlsearch'| farsi Compiled with Farsi support |farsi|. @@ -7288,6 +7814,7 @@ multi_byte Compiled with support for 'encoding' multi_byte_encoding 'encoding' is set to a multi-byte encoding. multi_byte_ime Compiled with support for IME input method. multi_lang Compiled with support for multiple languages. +nvim This is Nvim. |has-patch| ole Compiled with OLE automation support for Win32. path_extra Compiled with up/downwards search in 'path' and 'tags' persistent_undo Compiled with support for persistent undo history. @@ -7323,12 +7850,14 @@ termresponse Compiled with support for |t_RV| and |v:termresponse|. textobjects Compiled with support for |text-objects|. tgetent Compiled with tgetent support, able to use a termcap or terminfo file. +timers Compiled with |timer_start()| support. title Compiled with window title support |'title'|. toolbar Compiled with support for |gui-toolbar|. unix Unix version of Vim. user_commands User-defined commands. vertsplit Compiled with vertically split windows |:vsplit|. vim_starting True while initial source'ing takes place. |startup| + *vim_starting* virtualedit Compiled with 'virtualedit' option. visual Compiled with Visual mode. visualextra Compiled with extra Visual mode commands. @@ -7953,7 +8482,7 @@ This does NOT work: > From Vim version 4.5 until 5.0, every Ex command in between the ":if" and ":endif" is ignored. These two commands were just to allow for future expansions in a - backwards compatible way. Nesting was allowed. Note + backward compatible way. Nesting was allowed. Note that any ":else" or ":elseif" was ignored, the "else" part was not executed either. @@ -8020,14 +8549,6 @@ This does NOT work: > endfor < Note that reordering the list (e.g., with sort() or reverse()) may have unexpected effects. - Note that the type of each list item should be - identical to avoid errors for the type of {var} - changing. Unlet the variable at the end of the loop - to allow multiple item types: > - for item in ["foo", ["bar"]] - echo item - unlet item " E706 without this - endfor :for [{var1}, {var2}, ...] in {listlist} :endfo[r] diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 76aa3a50ce..d15815191e 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 7.4. Last change: 2015 Dec 06 +*filetype.txt* For Vim version 7.4. Last change: 2016 Jun 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -500,7 +500,7 @@ Options: avoid that a Subject line with "Vim:" in it will cause an error message. 'textwidth' is set to 72. This is often recommended for e-mail. -'formatoptions' is set to break text lines and to repeat the comment leader +'formatoptions' is set to break text lines and to repeat the comment leader in new lines, so that a leading ">" for quotes is repeated. You can also format quoted text with |gq|. @@ -512,37 +512,44 @@ Local mappings: MAN *ft-man-plugin* *:Man* *man.vim* -Displays a manual page in a nice way. Also see the user manual -|find-manpage|. +View manpages in Nvim. Supports highlighting, completion, locales, and +navigation. Also see |find-manpage|. -To start using the ":Man" command before any manual page was loaded, source -this script from your startup vimrc file: > +To use Nvim as a manpager: > + export MANPAGER="nvim -c 'set ft=man' -" - runtime ftplugin/man.vim +man.vim will always attempt to reuse the closest man window (above/left) but +otherwise create a split. -Options: -'iskeyword' the '.' character is added to be able to use CTRL-] on the - manual page name. +The case sensitivity of completion is controlled by 'fileignorecase'. Commands: -Man {name} Display the manual page for {name} in a window. -Man {number} {name} - Display the manual page for {name} in a section {number}. - -Global mapping: -<Leader>K Displays the manual page for the word under the cursor. +Man {name} Display the manpage for {name}. +Man {sect} {name} Display the manpage for {name} and section {sect}. +Man {name}({sect}) Alternate syntax which completes the section. +Man {sect} {name}({sect}) Used during completion to show the real section of + when the provided section is a prefix, e.g. 1m vs 1. +Man {path} Open the manpage specified by path. Prepend "./" if + page is in the current directory. +Man Open the manpage for the <cWORD> (man buffers) + or <cword> (non-man buffers) under the cursor. + +|:Man| accepts command modifiers. For example, to use a vertical split: > + :vertical Man printf Local mappings: -CTRL-] Jump to the manual page for the word under the cursor. -CTRL-T Jump back to the previous manual page. -q Same as ":quit" - -To enable folding use this: > - let g:ft_man_folding_enable = 1 -If you do not like the default folding, use an autocommand to add your desired -folding style instead. For example: > - autocmd FileType man setlocal foldmethod=indent foldenable +K or CTRL-] Jump to the manpage for the <cWORD> under the + cursor. Takes a count for the section. +CTRL-T Jump back to the location that the manpage was + opened from. +q :quit if invoked as $MANPAGER, otherwise :close. +Variables: +*g:no_man_maps* Do not create mappings in manpage buffers. +*g:ft_man_folding_enable* Fold manpages with foldmethod=indent foldnestmax=1. +*b:man_default_sects* Comma-separated, ordered list of preferred sections. + For example in C one usually wants section 3 or 2: > + :let b:man_default_sections = '3,2' PDF *ft-pdf-plugin* diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 8d97678af2..1e8bb408d9 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -395,9 +395,9 @@ You may make selections with the mouse (see |gui-mouse-select|), or by using Vim's Visual mode (see |v|). If 'a' is present in 'guioptions', then whenever a selection is started (Visual or Select mode), or when the selection is changed, Vim becomes the owner of the windowing system's primary selection -(on MS-Windows the |gui-clipboard| is used). +(on MS-Windows the |clipboard| is used). - *clipboard* + *primary-selection* There is a special register for storing this selection, it is the "* register. Nothing is put in here unless the information about what text is selected is about to change (e.g. with a left mouse click somewhere), or when @@ -825,13 +825,13 @@ the <CR> key. |<>|) See section |42.4| in the user manual. - *:tmenu* *:tm* + *:tmenu* :tm[enu] {menupath} {rhs} Define a tip for a menu or tool. {only in X11 and Win32 GUI} :tm[enu] [menupath] List menu tips. {only in X11 and Win32 GUI} - *:tunmenu* *:tu* + *:tunmenu* :tu[nmenu] {menupath} Remove a tip for a menu or tool. {only in X11 and Win32 GUI} diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt deleted file mode 100644 index 228be9eab2..0000000000 --- a/runtime/doc/gui_w32.txt +++ /dev/null @@ -1,437 +0,0 @@ -*gui_w32.txt* For Vim version 7.4. Last change: 2014 Dec 20 - - - VIM REFERENCE MANUAL by Bram Moolenaar - - -Vim's Win32 Graphical User Interface *gui-w32* *win32-gui* - -1. Starting the GUI |gui-w32-start| -2. Vim as default editor |vim-default-editor| -3. Using the clipboard |gui-clipboard| -4. Shell Commands |gui-shell-win32| -5. Special colors |win32-colors| -6. Windows dialogs & browsers |gui-w32-dialogs| -7. Command line arguments |gui-w32-cmdargs| -8. Various |gui-w32-various| - -Other relevant documentation: -|gui.txt| For generic items of the GUI. -|os_win32.txt| For Win32 specific items. - -============================================================================== -1. Starting the GUI *gui-w32-start* - -The Win32 GUI version of Vim will always start the GUI, no matter how you -start it or what it's called. - -The GUI will always run in the Windows subsystem. Mostly shells automatically -return with a command prompt after starting gvim. If not, you should use the -"start" command: > - start gvim [options] file .. - -Note: All fonts (bold, italic) must be of the same size!!! If you don't do -this, text will disappear or mess up the display. Vim does not check the font -sizes. It's the size in screen pixels that must be the same. Note that some -fonts that have the same point size don't have the same pixel size! -Additionally, the positioning of the fonts must be the same (ascent and -descent). - -The Win32 GUI has an extra menu item: "Edit/Select Font". It brings up the -standard Windows font selector. - -Setting the menu height doesn't work for the Win32 GUI. - - *gui-win32-maximized* -If you want Vim to start with a maximized window, add this command to your -vimrc or gvimrc file: > - au GUIEnter * simalt ~x -< -============================================================================== -2. Vim as default editor *vim-default-editor* - -To set Vim as the default editor for a file type: -1. Start a Windows Explorer -2. Choose View/Options -> File Types -3. Select the path to gvim for every file type that you want to use it for. - (you can also use three spaces in the file type field, for files without an - extension). - In the "open" action, use: > - gvim "%1" -< The quotes are required for using file names with embedded spaces. - You can also use this: > - gvim "%L" -< This should avoid short (8.3 character) file names in some situations. But - I'm not sure if this works everywhere. - -When you open a file in Vim by double clicking it, Vim changes to that -file's directory. - -If you want Vim to start full-screen, use this for the Open action: > - gvim -c "simalt ~x" "%1" - -Another method, which also works when you put Vim in another directory (e.g., -when you have got a new version): -1. select a file you want to use Vim with -2. <Shift-F10> -3. select "Open With..." menu entry -4. click "Other..." -5. browse to the (new) location of Vim and click "Open" -6. make "Always Use this program..." checked -7. <OK> - - *send-to-menu* *sendto* -You can also install Vim in the "Send To" menu: -1. Start a Windows Explorer -2. Navigate to your sendto directory: - Windows NT: %windir%\profiles\%user%\sendto (e.g. - "c:\winnt\profiles\mattha\sendto"). -3. Right-click in the file pane and select New->Shortcut -4. Follow the shortcut wizard, using the full path to VIM/GVIM. - -When you 'send a file to Vim', Vim changes to that file's directory. Note, -however, that any long directory names will appear in their short (MS-DOS) -form. This is a limitation of the Windows "Send To" mechanism. - - *notepad* -You could replace notepad.exe with gvim.exe, but that has a few side effects. -Some programs rely on notepad arguments, which are not recognized by Vim. For -example "notepad -p" is used by some applications to print a file. It's -better to leave notepad where it is and use another way to start Vim. - - *win32-popup-menu* -A more drastic approach is to install an "Edit with Vim" entry in the popup -menu for the right mouse button. With this you can edit any file with Vim. - -This can co-exist with the file associations mentioned above. The difference -is that the file associations will make starting Vim the default action. With -the "Edit with Vim" menu entry you can keep the existing file association for -double clicking on the file, and edit the file with Vim when you want. For -example, you can associate "*.mak" with your make program. You can execute -the makefile by double clicking it and use the "Edit with Vim" entry to edit -the makefile. - -You can select any files and right-click to see a menu option called "Edit -with gvim". Choosing this menu option will invoke gvim with the file you have -selected. If you select multiple files, you will find two gvim-related menu -options: -"Edit with multiple gvims" -- one gvim for each file in the selection -"Edit with single gvim" -- one gvim for all the files in the selection -And if there already is a gvim running: -"Edit with existing gvim" -- edit the file with the running gvim - -The "edit with existing Vim" entries can be disabled by adding an entry in the -registry under HKLM\Software\Vim\Gvim, named DisableEditWithExisting, and with -any value. - *install-registry* -You can add the "Edit with Vim" menu entry in an easy way by using the -"install.exe" program. It will add several registry entries for you. - -You can also do this by hand. This is complicated! Use the install.exe if -you can. - -1. Start the registry editor with "regedit". -2. Add these keys: - key value name value ~ - HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99} - {default} Vim Shell Extension - HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32 - {default} {path}\gvimext.dll - ThreadingModel Apartment - HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim - {default} {51EEE242-AD87-11d3-9C1E-0090278BBD99} - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved - {51EEE242-AD87-11d3-9C1E-0090278BBD99} - Vim Shell Extension - HKEY_LOCAL_MACHINE\Software\Vim\Gvim - path {path}\gvim.exe - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\vim 5.6 - DisplayName Vim 5.6: Edit with Vim popup menu entry - UninstallString {path}\uninstal.exe - - Replace {path} with the path that leads to the executable. - Don't type {default}, this is the value for the key itself. - -To remove "Edit with Vim" from the popup menu, just remove the registry -entries mentioned above. The "uninstal.exe" program can do this for you. You -can also use the entry in the Windows standard "Add/Remove Programs" list. - -If you notice that this entry overrules other file type associations, set -those associations again by hand (using Windows Explorer, see above). This -only seems to happen on some Windows NT versions (Windows bug?). Procedure: -1. Find the name of the file type. This can be done by starting the registry - editor, and searching for the extension in \\HKEY_CLASSES_ROOT -2. In a Windows Explorer, use View/Options/File Types. Search for the file - type in the list and click "Edit". In the actions list, you can select on - to be used as the default (normally the "open" action) and click on the - "Set Default" button. - - -Vim in the "Open With..." context menu *win32-open-with-menu* - -If you use the Vim install program you have the choice to add Vim to the "Open -With..." menu. This means you can use Vim to edit many files. Not every file -(for unclear reasons...), thus the "Edit with Vim" menu entry is still useful. - -One reason to add this is to be able to edit HTML files directly from Internet -Explorer. To enable this use the "Tools" menu, "Internet Options..." entry. -In the dialog select the "Programs" tab and select Vim in the "HTML editor" -choice. If it's not there than installing didn't work properly. - -Doing this manually can be done with this script: - ----------------------------------------------------------- -REGEDIT4 - -[HKEY_CLASSES_ROOT\Applications\gvim.exe] - -[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell] - -[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit] - -[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command] -@="c:\\vim\\vim62\\gvim.exe \"%1\"" - -[HKEY_CLASSES_ROOT\.htm\OpenWithList\gvim.exe] - -[HKEY_CLASSES_ROOT\*\OpenWithList\gvim.exe] - ----------------------------------------------------------- - -Change the "c:\\vim\\vim62" bit to where gvim.exe is actually located. - -To uninstall this run the Vim uninstall program or manually delete the -registry entries with "regedit". - -============================================================================== -3. Using the clipboard *gui-clipboard* - -Windows has a clipboard, where you can copy text to, and paste text from. Vim -supports this in several ways. For other systems see |gui-selections|. - -The "* register reflects the contents of the clipboard. |quotestar| - -When the "unnamed" string is included in the 'clipboard' option, the unnamed -register is the same. Thus you can yank to and paste from the clipboard -without prepending "* to commands. - -The 'a' flag in 'guioptions' is not included by default. This means that text -is only put on the clipboard when an operation is performed on it. Just -Visually selecting text doesn't put it on the clipboard. When the 'a' flag is -included, the text is copied to the clipboard even when it is not operated -upon. - - *mswin.vim* -To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V, use the -$VIMRUNTIME/mswin.vim script. You could add this line to your _vimrc file: > - source $VIMRUNTIME/mswin.vim - -Since CTRL-C is used to copy the text to the clipboard, it can't be used to -cancel an operation. Use CTRL-Break for that. - -CTRL-Z is used for undo. This means you can't suspend Vim with this key, use -|:suspend| instead (if it's supported at all). - - *CTRL-V-alternative* *CTRL-Q* -Since CTRL-V is used to paste, you can't use it to start a blockwise Visual -selection. You can use CTRL-Q instead. You can also use CTRL-Q in Insert -mode and Command-line mode to get the old meaning of CTRL-V. But CTRL-Q -doesn't work for terminals when it's used for control flow. - -NOTE: The clipboard support still has a number of bugs. - -============================================================================== -4. Shell Commands *gui-shell-win32* - -Vim uses another window for external commands, to make it possible to run any -command. The external command gets its own environment for running, just like -it was started from a DOS prompt. - - *win32-vimrun* -Executing an external command is done indirectly by the "vimrun" command. The -"vimrun.exe" must be in the path for this to work. Or it must be in the same -directory as the Vim executable. If "vimrun" cannot be found, the command is -executed directly, but then the DOS window closes immediately after the -external command has finished. -WARNING: If you close this window with the "X" button, and confirm the -question if you really want to kill the application, Vim may be killed too! -(This does not apply to commands run asynchronously with ":!start".) - - *win32-!start* -Normally, Vim waits for a command to complete before continuing (this makes -sense for most shell commands which produce output for Vim to use). If you -want Vim to start a program and return immediately, you can use the following -syntax on W95 & NT: > - :!start [/min] {command} -The optional "/min" causes the window to be minimized. - -============================================================================== -5. Special colors *win32-colors* - -On Win32, the normal DOS colors can be used. See |dos-colors|. - -Additionally the system configured colors can also be used. These are known -by the names Sys_XXX, where XXX is the appropriate system color name, from the -following list (see the Win32 documentation for full descriptions). Case is -ignored. - -Sys_3DDKShadow Sys_3DFace Sys_BTNFace -Sys_3DHilight Sys_3DHighlight Sys_BTNHilight -Sys_BTNHighlight Sys_3DLight Sys_3DShadow -Sys_BTNShadow Sys_ActiveBorder Sys_ActiveCaption -Sys_AppWorkspace Sys_Background Sys_Desktop -Sys_BTNText Sys_CaptionText Sys_GrayText -Sys_Highlight Sys_HighlightText Sys_InactiveBorder -Sys_InactiveCaption Sys_InactiveCaptionText Sys_InfoBK -Sys_InfoText Sys_Menu Sys_MenuText -Sys_ScrollBar Sys_Window Sys_WindowFrame -Sys_WindowText - -Probably the most useful values are - Sys_Window Normal window background - Sys_WindowText Normal window text - Sys_Highlight Highlighted background - Sys_HighlightText Highlighted text - -These extra colors are also available: -Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet, - - *rgb.txt* -Additionally, colors defined by a "rgb.txt" file can be used. This file is -well known from X11. A few lines from it: > - - 255 218 185 peach puff - 205 133 63 peru - 255 181 197 pink - -This shows the layout of the file: First the R, G and B value as a decimal -number, followed by the name of the color. The four fields are separated by -spaces. - -You can get an rgb.txt file from any X11 distribution. It is located in a -directory like "/usr/X11R6/lib/X11/". For Vim it must be located in the -$VIMRUNTIME directory. Thus the file can be found with "$VIMRUNTIME/rgb.txt". - -============================================================================== - *gui-w32-dialogs* *dialog* -6. Windows dialogs & browsers - -The Win32 GUI can use familiar Windows components for some operations, as well -as the traditional interface shared with the console version. - - -6.1 Dialogs - -The dialogs displayed by the "confirm" family (i.e. the 'confirm' option, -|:confirm| command and |confirm()| function) are GUI-based rather than the -console-based ones used by other versions. The 'c' flag in 'guioptions' -changes this. - - -6.2 File Browsers - -When prepending ":browse" before file editing commands, a file requester is -used to allow you to select an existing file. See |:browse|. - -============================================================================== -7. Command line arguments *gui-w32-cmdargs* - -Analysis of a command line into parameters is not standardised in MS Windows. -Gvim has to provide logic to analyse a command line. This logic is likely to -be different from the default logic provided by a compilation system used to -build vim. The differences relate to unusual double quote (") usage. -The arguments "C:\My Music\freude.txt" and "+/Sch\"iller" are handled in the -same way. The argument "+/Sch""iller" may be handled different by gvim and -vim, depending what it was compiled with. - -The rules are: - a) A parameter is a sequence of graphic characters. - b) Parameters are separated by white space. - c) A parameter can be enclosed in double quotes to include white space. - d) A sequence of zero or more backslashes (\) and a double quote (") - is special. The effective number of backslashes is halved, rounded - down. An even number of backslashes reverses the acceptability of - spaces and tabs, an odd number of backslashes produces a literal - double quote. - -So: - " is a special double quote - \" is a literal double quote - \\" is a literal backslash and a special double quote - \\\" is a literal backslash and a literal double quote - \\\\" is 2 literal backslashes and a special double quote - \\\\\" is 2 literal backslashes and a literal double quote - etc. - -Example: > - gvim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\" - -opens "C:\My Music\freude" and executes the line mode commands: > - set ignorecase; /"foo\ and /bar\" - -============================================================================== -8. Various *gui-w32-various* - - *gui-w32-printing* -The "File/Print" menu prints the text with syntax highlighting, see -|:hardcopy|. If you just want to print the raw text and have a default -printer installed this should also work: > - :w >>prn - -Vim supports a number of standard MS Windows features. Some of these are -detailed elsewhere: see |'mouse'|, |win32-hidden-menus|. - - *drag-n-drop-win32* -You can drag and drop one or more files into the Vim window, where they will -be opened as normal. See |drag-n-drop|. - - *:simalt* *:sim* -:sim[alt] {key} simulate pressing {key} while holding Alt pressed. - {only for Win32 versions} - -Normally, Vim takes control of all Alt-<Key> combinations, to increase the -number of possible mappings. This clashes with the standard use of Alt as the -key for accessing menus. -The quick way of getting standard behavior is to set the 'winaltkeys' option -to "yes". This however prevents you from mapping Alt keys at all. -Another way is to set 'winaltkeys' to "menu". Menu shortcut keys are then -handled by windows, other ALT keys can be mapped. This doesn't allow a -dependency on the current state though. -To get round this, the :simalt command allows Vim (when 'winaltkeys' is not -"yes") to fake a Windows-style Alt keypress. You can use this to map Alt key -combinations (or anything else for that matter) to produce standard Windows -actions. Here are some examples: > - - :map <M-f> :simalt f<CR> -This makes Alt-F pop down the 'File' menu (with the stock Menu.vim) by -simulating the keystrokes Alt, F. > - :map <M-Space> :simalt ~<CR> -This maps Alt-Space to pop down the system menu for the Vim window. Note that -~ is used by simalt to represent the <Space> character. > - :map <C-n> :simalt ~n<CR> -Maps Control-N to produce the keys Alt-Space followed by N. This minimizes the -Vim window via the system menu. - -Note that the key changes depending on the language you are using. - - *intellimouse-wheel-problems* -When using the Intellimouse mouse wheel causes Vim to stop accepting input, go -to: - ControlPanel - Mouse - Wheel - UniversalScrolling - Exceptions - -And add gvim to the list of applications. This problem only appears to happen -with the Intellimouse driver 2.2 and when "Universal Scrolling" is turned on. - - -XPM support *w32-xpm-support* - -Gvim can be build on MS-Windows with support for XPM files. |+xpm_w32| -See the Make_mvc.mak file for instructions, search for XPM. - -To try out if XPM support works do this: > - :help - :exe 'sign define vimxpm icon=' . $VIMRUNTIME . '\\vim16x16.xpm' - :exe 'sign place 1 line=1 name=vimxpm file=' . expand('%:p') -< - - vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 19bcb35da8..a81d32831b 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 7.4. Last change: 2015 Apr 15 +*help.txt* For Vim version 7.4. Last change: 2016 Mar 31 VIM - main help file k @@ -9,14 +9,14 @@ Close this window: Use ":q<Enter>". Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-]. With the mouse: Double-click the left mouse button on a tag, e.g. |bars|. - Jump back: Type CTRL-T or CTRL-O (repeat to go further back). + Jump back: Type CTRL-T or CTRL-O. Repeat to go further back. Get specific help: It is possible to go directly to whatever you want help on, by giving an argument to the |:help| command. - It is possible to further specify the context: - *help-context* + Prepend something to specify the context: *help-context* + WHAT PREPEND EXAMPLE ~ - Normal mode command (nothing) :help x + Normal mode command :help x Visual mode command v_ :help v_u Insert mode command i_ :help i_<Esc> Command-line command : :help :quit @@ -24,6 +24,8 @@ Get specific help: It is possible to go directly to whatever you want help Vim command argument - :help -r Option ' :help 'textwidth' Regular expression / :help /[ + See |help-summary| for more contexts and an explanation. + Search for help: Type ":help word", then hit CTRL-D to see matching help entries for "word". Or use ":helpgrep word". |:helpgrep| @@ -152,6 +154,7 @@ GUI ~ Interfaces ~ |if_cscop.txt| using Cscope with Vim |if_pyth.txt| Python interface +|if_ruby.txt| Ruby interface |debugger.txt| Interface with a debugger |sign.txt| debugging signs diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index f3533b8815..ad1611133a 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -1,4 +1,4 @@ -*helphelp.txt* For Vim version 7.4. Last change: 2014 Sep 19 +*helphelp.txt* For Vim version 7.4. Last change: 2016 Apr 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -185,9 +185,12 @@ command: > < *:helpt* *:helptags* - *E154* *E150* *E151* *E152* *E153* *E670* + *E154* *E150* *E151* *E152* *E153* *E670* *E856* :helpt[ags] [++t] {dir} Generate the help tags file(s) for directory {dir}. + When {dir} is ALL then all "doc" directories in + 'runtimepath' will be used. + All "*.txt" and "*.??x" files in the directory and sub-directories are scanned for a help tag definition in between stars. The "*.??x" files are for @@ -196,9 +199,11 @@ command: > sorted. When there are duplicates an error message is given. An existing tags file is silently overwritten. + The optional "++t" argument forces adding the "help-tags" tag. This is also done when the {dir} is equal to $VIMRUNTIME/doc. + To rebuild the help tags in the runtime directory (requires write permission there): > :helptags $VIMRUNTIME/doc @@ -249,7 +254,9 @@ The second one finds the English user manual, even when 'helplang' is set to When using command-line completion for the ":help" command, the "@en" extension is only shown when a tag exists for multiple languages. When the -tag only exists for English "@en" is omitted. +tag only exists for English "@en" is omitted. When the first candidate has an +"@ab" extension and it matches the first language in 'helplang' "@ab" is also +omitted. When using |CTRL-]| or ":help!" in a non-English help file Vim will try to find the tag in the same language. If not found then 'helplang' will be used @@ -306,6 +313,10 @@ aligned on a line. When referring to an existing help tag and to create a hot-link, place the name between two bars (|) eg. |help-writing|. +When referring to a Vim command and to create a hot-link, place the +name between two backticks, eg. inside `:filetype`. You will see this is +highlighted as a command, like a code block (see below). + When referring to a Vim option in the help file, place the option name between two single quotes, eg. 'statusline' diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index 70f8d1c6f3..7482f5eebb 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -96,8 +96,8 @@ command does the same and also splits the window (short: "scs"). The available subcommands are: - *E563* *E564* *E566* *E568* *E569* *E622* *E623* - *E625* *E626* *E609* + *E563* *E564* *E566* *E568* *E622* *E623* *E625* + *E626* *E609* add : Add a new cscope database/connection. USAGE :cs add {file|dir} [pre-path] [flags] @@ -128,6 +128,7 @@ The available subcommands are: 6 or e: Find this egrep pattern 7 or f: Find this file 8 or i: Find files #including this file + 9 or a: Find places where this symbol is assigned a value For all types, except 4 and 6, leading white space for {name} is removed. For 4 and 6 there is exactly one space between {querytype} @@ -254,13 +255,13 @@ started will have no effect! {not available when compiled without the |+quickfix| feature} 'cscopequickfix' specifies whether to use quickfix window to show cscope results. This is a list of comma-separated values. Each item consists of -|cscope-find| command (s, g, d, c, t, e, f or i) and flag (+, - or 0). +|cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0). '+' indicates that results must be appended to quickfix window, '-' implies previous results clearance, '0' or command absence - don't use quickfix. Search is performed from start until first command occurrence. The default value is "" (don't use quickfix anyway). The following value seems to be useful: > - :set cscopequickfix=s-,c-,d-,i-,t-,e- + :set cscopequickfix=s-,c-,d-,i-,t-,e-,a- < *cscopetag* *cst* If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t" @@ -418,6 +419,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): > nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR> + nmap <C-_>a :cs find a <C-R>=expand("<cword>")<CR><CR> " Using 'CTRL-spacebar' then a search type makes the vim window " split horizontally, with search result displayed in @@ -431,6 +433,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): > nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR> + nmap <C-Space>a :scs find a <C-R>=expand("<cword>")<CR><CR> " Hitting CTRL-space *twice* before the search type does a vertical " split instead of a horizontal one @@ -449,6 +452,8 @@ Cscope Home Page (http://cscope.sourceforge.net/): > \:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-Space><C-Space>d \:vert scs find d <C-R>=expand("<cword>")<CR><CR> + nmap <C-Space><C-Space>a + \:vert scs find a <C-R>=expand("<cword>")<CR><CR> ============================================================================== 7. Cscope availability and information *cscope-info* diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index f6bd365299..b6fe234de4 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -16,7 +16,7 @@ The Python Interface to Vim *python* *Python* 8. pyeval(), py3eval() Vim functions |python-pyeval| 9. Python 3 |python3| -See |nvim-python| for more information. {Nvim} +See |provider-python| for more information. {Nvim} ============================================================================== 1. Commands *python-commands* @@ -699,7 +699,7 @@ if the `:py3` command is working: > :py3 print("Hello") < *:py3file* The `:py3file` command works similar to `:pyfile`. - *:py3do* *E863* + *:py3do* The `:py3do` command works similar to `:pydo`. *E880* diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt new file mode 100644 index 0000000000..fdd63501ea --- /dev/null +++ b/runtime/doc/if_ruby.txt @@ -0,0 +1,185 @@ +*if_ruby.txt* + + + VIM REFERENCE MANUAL by Shugo Maeda + +The Ruby Interface to Vim *ruby* *Ruby* + + +1. Commands |ruby-commands| +2. The VIM module |ruby-vim| +3. VIM::Buffer objects |ruby-buffer| +4. VIM::Window objects |ruby-window| +5. Global variables |ruby-globals| + + *E266* *E267* *E268* *E269* *E270* *E271* *E272* *E273* + +The home page for ruby is http://www.ruby-lang.org/. You can find links for +downloading Ruby there. + +============================================================================== +1. Commands *ruby-commands* + + *:ruby* *:rub* +:rub[y] {cmd} Execute Ruby command {cmd}. A command to try it out: > + :ruby print "Hello" + +:rub[y] << {endpattern} +{script} +{endpattern} + Execute Ruby script {script}. + {endpattern} must NOT be preceded by any white space. + If {endpattern} is omitted, it defaults to a dot '.' + like for the |:append| and |:insert| commands. This + form of the |:ruby| command is mainly useful for + including ruby code in vim scripts. + Note: This command doesn't work when the Ruby feature + wasn't compiled in. To avoid errors, see + |script-here|. + +Example Vim script: > + + function! RedGem() + ruby << EOF + class Garnet + def initialize(s) + @buffer = VIM::Buffer.current + vimputs(s) + end + def vimputs(s) + @buffer.append(@buffer.count,s) + end + end + gem = Garnet.new("pretty") + EOF + endfunction +< + + *:rubydo* *:rubyd* *E265* +:[range]rubyd[o] {cmd} Evaluate Ruby command {cmd} for each line in the + [range], with $_ being set to the text of each line in + turn, without a trailing <EOL>. Setting $_ will change + the text, but note that it is not possible to add or + delete lines using this command. + The default for [range] is the whole file: "1,$". + + *:rubyfile* *:rubyf* +:rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as + ":ruby load 'file'", but allows file name completion. + +Executing Ruby commands is not possible in the |sandbox|. + +============================================================================== +2. The VIM module *ruby-vim* + +Ruby code gets all of its access to vim via the "VIM" module. + +Overview > + print "Hello" # displays a message + VIM.command(cmd) # execute an Ex command + num = VIM::Window.count # gets the number of windows + w = VIM::Window[n] # gets window "n" + cw = VIM::Window.current # gets the current window + num = VIM::Buffer.count # gets the number of buffers + b = VIM::Buffer[n] # gets buffer "n" + cb = VIM::Buffer.current # gets the current buffer + w.height = lines # sets the window height + w.cursor = [row, col] # sets the window cursor position + pos = w.cursor # gets an array [row, col] + name = b.name # gets the buffer file name + line = b[n] # gets a line from the buffer + num = b.count # gets the number of lines + b[n] = str # sets a line in the buffer + b.delete(n) # deletes a line + b.append(n, str) # appends a line after n + line = VIM::Buffer.current.line # gets the current line + num = VIM::Buffer.current.line_number # gets the current line number + VIM::Buffer.current.line = "test" # sets the current line number +< + +Module Functions: + + *ruby-message* +VIM::message({msg}) + Displays the message {msg}. + + *ruby-set_option* +VIM::set_option({arg}) + Sets a vim option. {arg} can be any argument that the ":set" command + accepts. Note that this means that no spaces are allowed in the + argument! See |:set|. + + *ruby-command* +VIM::command({cmd}) + Executes Ex command {cmd}. + + *ruby-evaluate* +VIM::evaluate({expr}) + Evaluates {expr} using the vim internal expression evaluator (see + |expression|). Returns the expression result as a string. + A |List| is turned into a string by joining the items and inserting + line breaks. + +============================================================================== +3. VIM::Buffer objects *ruby-buffer* + +VIM::Buffer objects represent vim buffers. + +Class Methods: + +current Returns the current buffer object. +count Returns the number of buffers. +self[{n}] Returns the buffer object for the number {n}. The first number + is 0. + +Methods: + +name Returns the name of the buffer. +number Returns the number of the buffer. +count Returns the number of lines. +length Returns the number of lines. +self[{n}] Returns a line from the buffer. {n} is the line number. +self[{n}] = {str} + Sets a line in the buffer. {n} is the line number. +delete({n}) Deletes a line from the buffer. {n} is the line number. +append({n}, {str}) + Appends a line after the line {n}. +line Returns the current line of the buffer if the buffer is + active. +line = {str} Sets the current line of the buffer if the buffer is active. +line_number Returns the number of the current line if the buffer is + active. + +============================================================================== +4. VIM::Window objects *ruby-window* + +VIM::Window objects represent vim windows. + +Class Methods: + +current Returns the current window object. +count Returns the number of windows. +self[{n}] Returns the window object for the number {n}. The first number + is 0. + +Methods: + +buffer Returns the buffer displayed in the window. +height Returns the height of the window. +height = {n} Sets the window height to {n}. +width Returns the width of the window. +width = {n} Sets the window width to {n}. +cursor Returns a [row, col] array for the cursor position. +cursor = [{row}, {col}] + Sets the cursor position to {row} and {col}. + +============================================================================== +5. Global variables *ruby-globals* + +There are two global variables. + +$curwin The current window object. +$curbuf The current buffer object. + +============================================================================== + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 6e96d9b816..496ccbc703 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -810,7 +810,7 @@ PHP indenting can be altered in several ways by modifying the values of some global variables: *php-comment* *PHP_autoformatcomment* -To not enable auto-formating of comments by default (if you want to use your +To not enable auto-formatting of comments by default (if you want to use your own 'formatoptions'): > :let g:PHP_autoformatcomment = 0 diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index e6c1ccc0cf..7388652f16 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.4. Last change: 2016 Jan 03 +*index.txt* For Vim version 7.4. Last change: 2016 Jun 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -48,6 +48,7 @@ tag char action in Insert mode ~ |i_CTRL-G_k| CTRL-G k line up, to column where inserting started |i_CTRL-G_k| CTRL-G <Up> line up, to column where inserting started |i_CTRL-G_u| CTRL-G u start new undoable edit +|i_CTRL-G_U| CTRL-G U don't break undo with next cursor movement |i_<BS>| <BS> delete character before the cursor |i_digraph| {char1}<BS>{char2} enter digraph (only when 'digraph' option set) @@ -857,6 +858,7 @@ tag command note action in Visual mode ~ ------------------------------------------------------------------------------ |v_CTRL-\_CTRL-N| CTRL-\ CTRL-N stop Visual mode |v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode' +|v_CTRL-A| CTRL-A 2 add N to number in highlighted text |v_CTRL-C| CTRL-C stop Visual mode |v_CTRL-G| CTRL-G toggle between Visual mode and Select mode |v_<BS>| <BS> 2 Select mode: delete highlighted area @@ -865,6 +867,7 @@ tag command note action in Visual mode ~ command |v_CTRL-V| CTRL-V make Visual mode blockwise or stop Visual mode +|v_CTRL-X| CTRL-X 2 subtract N from number in highlighted text |v_<Esc>| <Esc> stop Visual mode |v_CTRL-]| CTRL-] jump to highlighted tag |v_!| !{filter} 2 filter the highlighted lines through the @@ -921,6 +924,8 @@ tag command note action in Visual mode ~ |v_a}| a} same as aB |v_c| c 2 delete highlighted area and start insert |v_d| d 2 delete highlighted area +|v_g_CTRL-A| g CTRL-A 2 add N to number in highlighted text +|v_g_CTRL-X| g CTRL-X 2 subtract N from number in highlighted text |v_gJ| gJ 2 join the highlighted lines without inserting spaces |v_gq| gq 2 format the highlighted lines @@ -1129,6 +1134,7 @@ tag command action ~ |:caddfile| :caddf[ile] add error message to current quickfix list |:call| :cal[l] call a function |:catch| :cat[ch] part of a :try command +|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window |:cbuffer| :cb[uffer] parse error messages and jump to first error |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window @@ -1146,8 +1152,9 @@ tag command action ~ |:chdir| :chd[ir] change directory |:checkpath| :che[ckpath] list included files |:checktime| :checkt[ime] check timestamp of loaded buffers -|:clist| :cl[ist] list all errors |:clast| :cla[st] go to the specified error, default last one +|:clearjumps| :cle[arjumps] clear the jump list +|:clist| :cl[ist] list all errors |:close| :clo[se] close current window |:cmap| :cm[ap] like ":map" but for Command-line mode |:cmapclear| :cmapc[lear] clear all mappings for Command-line mode @@ -1171,7 +1178,7 @@ tag command action ~ |:cpfile| :cpf[ile] go to last error in previous file |:cquit| :cq[uit] quit Vim with an error code |:crewind| :cr[ewind] go to the specified error, default first one -|:cscope| :cs[cope] execute cscope command +|:cscope| :cs[cope] execute cscope command |:cstag| :cst[ag] use cscope to jump to a tag |:cunmap| :cu[nmap] like ":unmap" but for Command-line mode |:cunabbrev| :cuna[bbrev] like ":unabbrev" but for Command-line mode @@ -1286,11 +1293,12 @@ tag command action ~ |:last| :la[st] go to the last file in the argument list |:language| :lan[guage] set the language (locale) |:later| :lat[er] go to newer change, redo +|:lbottom| :lbo[ttom] scroll to the bottom of the location window |:lbuffer| :lb[uffer] parse locations and jump to first location |:lcd| :lc[d] change directory locally |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window -|:lcscope| :lcs[cope] like ":cscope" but uses location list +|:lcscope| :lcs[cope] like ":cscope" but uses location list |:ldo| :ld[o] execute command in valid location list entries |:lfdo| :lfd[o] execute command in each file in location list |:left| :le[ft] left align lines @@ -1341,7 +1349,7 @@ tag command action ~ |:marks| :marks list all marks |:match| :mat[ch] define a match to highlight |:menu| :me[nu] enter a new menu item -|:menutranslate| :menut[ranslate] add a menu translation item +|:menutranslate| :menut[ranslate] add a menu translation item |:messages| :mes[sages] view previously displayed messages |:mkexrc| :mk[exrc] write current mappings and settings to a file |:mksession| :mks[ession] write session info to a file @@ -1378,6 +1386,8 @@ tag command action ~ |:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode |:ounmenu| :ounme[nu] remove menu for Operator-pending mode |:ownsyntax| :ow[nsyntax] set new local syntax highlight for this window +|:packadd| :pa[ckadd] add a plugin from 'packpath' +|:packloadall| :packl[oadall] load all packages under 'packpath' |:pclose| :pc[lose] close preview window |:pedit| :ped[it] edit file in the preview window |:print| :p[rint] print lines @@ -1494,7 +1504,7 @@ tag command action ~ |:stop| :st[op] suspend the editor or escape to a shell |:stag| :sta[g] split window and jump to a tag |:startinsert| :star[tinsert] start Insert mode -|:startgreplace| :startg[replace] start Virtual Replace mode +|:startgreplace| :startg[replace] start Virtual Replace mode |:startreplace| :startr[eplace] start Replace mode |:stopinsert| :stopi[nsert] stop Insert mode |:stjump| :stj[ump] do ":tjump" and split window @@ -1515,14 +1525,14 @@ tag command action ~ |:tabdo| :tabdo execute command in each tab page |:tabedit| :tabe[dit] edit a file in a new tab page |:tabfind| :tabf[ind] find file in 'path', edit it in a new tab page -|:tabfirst| :tabfir[st] got to first tab page -|:tablast| :tabl[ast] got to last tab page +|:tabfirst| :tabfir[st] go to first tab page +|:tablast| :tabl[ast] go to last tab page |:tabmove| :tabm[ove] move tab page to other position |:tabnew| :tabnew edit a file in a new tab page |:tabnext| :tabn[ext] go to next tab page |:tabonly| :tabo[nly] close all tab pages except the current one |:tabprevious| :tabp[revious] go to previous tab page -|:tabrewind| :tabr[ewind] got to first tab page +|:tabrewind| :tabr[ewind] go to first tab page |:tabs| :tabs list the tab pages and what they contain |:tab| :tab create new tab when opening new window |:tag| :ta[g] jump to tag diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index f931dfa341..a82e17c857 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.4. Last change: 2015 Sep 15 +*insert.txt* For Vim version 7.4. Last change: 2016 Jan 31 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1436,7 +1436,7 @@ original HTML files completion of tags (and only tags) isn't context aware. RUBY *ft-ruby-omni* {Nvim} -NOTE: Completion for ruby code is not currently provided by Nvim. +NOTE: |compl-omni| for Ruby code requires |provider-ruby| to be installed. Ruby completion will parse your buffer on demand in order to provide a list of completions. These completions will be drawn from modules loaded by 'require' diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index cbe017e051..786097dd74 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -450,7 +450,7 @@ notation meaning equivalent decimal value(s) ~ <k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9* <S-...> shift-key *shift* *<S-* <C-...> control-key *control* *ctrl* *<C-* -<M-...> alt-key or meta-key *meta* *alt* *<M-* +<M-...> alt-key or meta-key *META* *meta* *alt* *<M-* <A-...> same as <M-...> *<A-* <D-...> command-key or "super" key *<D-* <t_xx> key with "xx" entry in termcap diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt index 587eba4162..1aa7ce06d6 100644 --- a/runtime/doc/job_control.txt +++ b/runtime/doc/job_control.txt @@ -40,7 +40,7 @@ for details. Job control is achieved by calling a combination of the |jobstart()|, |jobsend()| and |jobstop()| functions. Here's an example: > - function s:JobHandler(job_id, data, event) + function! s:JobHandler(job_id, data, event) dict if a:event == 'stdout' let str = self.shell.' stdout: '.join(a:data) elseif a:event == 'stderr' @@ -84,28 +84,41 @@ Here's what is happening: program. 2: The event type, which is "stdout", "stderr" or "exit". + Note: Buffered stdout/stderr data which has not been flushed by the sender + will not trigger the "stdout" callback (but if the process ends, the + "exit" callback will be triggered). + For example, "ruby -e" buffers output, so small strings will be + buffered unless "auto-flushing" ($stdout.sync=true) is enabled. > + function! Receive(job_id, data, event) + echom printf('%s: %s',a:event,string(a:data)) + endfunction + call jobstart(['ruby', '-e', + \ '$stdout.sync = true; 5.times do sleep 1 and puts "Hello Ruby!" end'], + \ {'on_stdout': 'Receive'}) +< https://github.com/neovim/neovim/issues/1592 + The options dictionary is passed as the "self" variable to the callback function. Here's a more object-oriented version of the above: > let Shell = {} - function Shell.on_stdout(job_id, data) + function Shell.on_stdout(job_id, data) dict call append(line('$'), self.get_name().' stdout: '.join(a:data)) endfunction - function Shell.on_stderr(job_id, data) + function Shell.on_stderr(job_id, data) dict call append(line('$'), self.get_name().' stderr: '.join(a:data)) endfunction - function Shell.on_exit(job_id, data) + function Shell.on_exit(job_id, data) dict call append(line('$'), self.get_name().' exited') endfunction - function Shell.get_name() + function Shell.get_name() dict return 'shell '.self.name endfunction - function Shell.new(name, ...) + function Shell.new(name, ...) dict let instance = extend(copy(g:Shell), {'name': a:name}) let argv = ['bash'] if a:0 > 0 diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 464c700a4d..53b152dc06 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.4. Last change: 2014 Dec 08 +*map.txt* For Vim version 7.4. Last change: 2016 Jul 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -55,6 +55,7 @@ modes. :im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap* :lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap* :cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap* +:tm[ap] {lhs} {rhs} |mapmode-t| *:tm* *:tmap* Map the key sequence {lhs} to {rhs} for the modes where the map command applies. The result, including {rhs}, is then further scanned for mappings. This @@ -71,6 +72,7 @@ modes. :ino[remap] {lhs} {rhs} |mapmode-i| *:ino* *:inoremap* :ln[oremap] {lhs} {rhs} |mapmode-l| *:ln* *:lnoremap* :cno[remap] {lhs} {rhs} |mapmode-c| *:cno* *:cnoremap* +:tno[remap] {lhs} {rhs} |mapmode-t| *:tno* *:tnoremap* Map the key sequence {lhs} to {rhs} for the modes where the map command applies. Disallow mapping of {rhs}, to avoid nested and recursive mappings. Often @@ -87,6 +89,7 @@ modes. :iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap* :lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap* :cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap* +:tu[nmap] {lhs} |mapmode-t| *:tu* *:tunmap* Remove the mapping of {lhs} for the modes where the map command applies. The mapping may remain defined for other modes where it applies. @@ -105,6 +108,7 @@ modes. :imapc[lear] |mapmode-i| *:imapc* *:imapclear* :lmapc[lear] |mapmode-l| *:lmapc* *:lmapclear* :cmapc[lear] |mapmode-c| *:cmapc* *:cmapclear* +:tmapc[lear] |mapmode-t| *:tmapc* *:tmapclear* Remove ALL mappings for the modes where the map command applies. Use the <buffer> argument to remove buffer-local @@ -121,6 +125,7 @@ modes. :im[ap] |mapmode-i| :lm[ap] |mapmode-l| :cm[ap] |mapmode-c| +:tm[ap] |mapmode-t| List all key mappings for the modes where the map command applies. Note that ":map" and ":map!" are used most often, because they include the other modes. @@ -135,6 +140,7 @@ modes. :im[ap] {lhs} |mapmode-i| *:imap_l* :lm[ap] {lhs} |mapmode-l| *:lmap_l* :cm[ap] {lhs} |mapmode-c| *:cmap_l* +:tm[ap] {lhs} |mapmode-t| *:tmap_l* List the key mappings for the key sequences starting with {lhs} in the modes where the map command applies. @@ -288,9 +294,9 @@ as a special key. 1.3 MAPPING AND MODES *:map-modes* - *mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o* + *mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o* *mapmode-t* -There are six sets of mappings +There are seven sets of mappings - For Normal mode: When typing commands. - For Visual mode: When typing commands while the Visual area is highlighted. - For Select mode: like Visual mode but typing text replaces the selection. @@ -298,6 +304,7 @@ There are six sets of mappings etc.). See below: |omap-info|. - For Insert mode. These are also used in Replace mode. - For Command-line mode: When entering a ":" or "/" command. +- For Terminal mode: When typing in a |:terminal| buffer. Special case: While typing a count for a command in Normal mode, mapping zero is disabled. This makes it possible to map zero without making it impossible @@ -316,6 +323,7 @@ Overview of which map command works in which mode. More details below. :imap :inoremap :iunmap Insert :lmap :lnoremap :lunmap Insert, Command-line, Lang-Arg :cmap :cnoremap :cunmap Command-line +:tmap :tnoremap :tunmap Terminal COMMANDS MODES ~ @@ -481,7 +489,7 @@ internal code is written to the script file. 1.6 SPECIAL CHARACTERS *:map-special-chars* - *map_backslash* + *map_backslash* *map-backslash* Note that only CTRL-V is mentioned here as a special character for mappings and abbreviations. When 'cpoptions' does not contain 'B', a backslash can also be used like CTRL-V. The <> notation can be fully used then |<>|. But @@ -492,21 +500,21 @@ To map a backslash, or use a backslash literally in the {rhs}, the special sequence "<Bslash>" can be used. This avoids the need to double backslashes when using nested mappings. - *map_CTRL-C* + *map_CTRL-C* *map-CTRL-C* Using CTRL-C in the {lhs} is possible, but it will only work when Vim is waiting for a key, not when Vim is busy with something. When Vim is busy CTRL-C interrupts/breaks the command. When using the GUI version on MS-Windows CTRL-C can be mapped to allow a Copy command to the clipboard. Use CTRL-Break to interrupt Vim. - *map_space_in_lhs* + *map_space_in_lhs* *map-space_in_lhs* To include a space in {lhs} precede it with a CTRL-V (type two CTRL-Vs for each space). - *map_space_in_rhs* + *map_space_in_rhs* *map-space_in_rhs* If you want a {rhs} that starts with a space, use "<Space>". To be fully Vi compatible (but unreadable) don't use the |<>| notation, precede {rhs} with a single CTRL-V (you have to type CTRL-V two times). - *map_empty_rhs* + *map_empty_rhs* *map-empty-rhs* You can create an empty {rhs} by typing nothing after a single CTRL-V (you have to type CTRL-V two times). Unfortunately, you cannot do this in a vimrc file. @@ -581,7 +589,7 @@ Upper and lowercase differences are ignored. It is not possible to put a comment after these commands, because the '"' character is considered to be part of the {lhs} or {rhs}. - *map_bar* + *map_bar* *map-bar* Since the '|' character is used to separate a map command from the next command, you will have to do something special to include a '|' in {rhs}. There are three methods: @@ -599,7 +607,7 @@ When 'b' is present in 'cpoptions', "\|" will be recognized as a mapping ending in a '\' and then another command. This is Vi compatible, but illogical when compared to other commands. - *map_return* + *map_return* *map-return* When you have a mapping that contains an Ex command, you need to put a line terminator after it to have it executed. The use of <CR> is recommended for this (see |<>|). Example: > @@ -1260,6 +1268,7 @@ completion can be enabled: -complete=mapping mapping name -complete=menu menus -complete=option options + -complete=packadd optional package |pack-add| names -complete=shellcmd Shell command -complete=sign |:sign| suboptions -complete=syntax syntax file names |'syntax'| @@ -1344,7 +1353,7 @@ Possible attributes are: Note that -range=N and -count=N are mutually exclusive - only one should be specified. - *E889* *:command-addr* + *:command-addr* It is possible that the special characters in the range like `.`, `$` or `%` which by default correspond to the current line, last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages. @@ -1398,6 +1407,27 @@ The valid escape sequences are <bang> (See the '-bang' attribute) Expands to a ! if the command was executed with a ! modifier, otherwise expands to nothing. + *<mods>* + <mods> The command modifiers, if specified. Otherwise, expands to + nothing. Supported modifiers are |:aboveleft|, |:belowright|, + |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|, + |:keepjumps|, |:keepmarks|, |:keeppatterns|, |:lockmarks|, + |:noswapfile|, |:silent|, |:tab|, |:topleft|, |:verbose|, and + |:vertical|. + Examples: > + command! -nargs=+ -complete=file MyEdit + \ for f in expand(<q-args>, 0, 1) | + \ exe '<mods> split ' . f | + \ endfor + + function! SpecialEdit(files, mods) + for f in expand(a:files, 0, 1) + exe a:mods . ' split ' . f + endfor + endfunction + command! -nargs=+ -complete=file Sedit + \ call SpecialEdit(<q-args>, <q-mods>) +< *<reg>* *<register>* <reg> (See the '-register' attribute) The optional register, if specified. Otherwise, expands to nothing. <register> diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt index c87ed317d4..355a1da423 100644 --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -1,4 +1,4 @@ -*mbyte.txt* For Vim version 7.4. Last change: 2013 May 18 +*mbyte.txt* For Vim version 7.4. Last change: 2016 Jul 21 VIM REFERENCE MANUAL by Bram Moolenaar et al. @@ -70,29 +70,24 @@ See |mbyte-locale| for details. ENCODING -If your locale works properly, Vim will try to set the 'encoding' option -accordingly. If this doesn't work you can overrule its value: > +Nvim always uses UTF-8 internally. Thus 'encoding' option is always set +to "utf-8" and cannot be changed. - :set encoding=utf-8 +All the text that is used inside Vim will be in UTF-8. Not only the text in +the buffers, but also in registers, variables, etc. -See |encoding-values| for a list of acceptable values. - -The result is that all the text that is used inside Vim will be in this -encoding. Not only the text in the buffers, but also in registers, variables, -etc. 'encoding' is read-only after startup because changing it would make the -existing text invalid. - -You can edit files in another encoding than what 'encoding' is set to. Vim +You can edit files in different encodings than UTF-8. Nvim will convert the file when you read it and convert it back when you write it. See 'fileencoding', 'fileencodings' and |++enc|. DISPLAY AND FONTS -If you are working in a terminal (emulator) you must make sure it accepts the -same encoding as which Vim is working with. +If you are working in a terminal (emulator) you must make sure it accepts +UTF-8, the encoding which Vim is working with. Otherwise only ASCII can +be displayed and edited correctly. -For the GUI you must select fonts that work with the current 'encoding'. This +For the GUI you must select fonts that work with UTF-8. This is the difficult part. It depends on the system you are using, the locale and a few other things. See the chapters on fonts: |mbyte-fonts-X11| for X-Windows and |mbyte-fonts-MSwin| for MS-Windows. @@ -216,10 +211,9 @@ You could make a small shell script for this. ============================================================================== 3. Encoding *mbyte-encoding* -Vim uses the 'encoding' option to specify how characters are identified and -encoded when they are used inside Vim. This applies to all the places where -text is used, including buffers (files loaded into memory), registers and -variables. +In Nvim UTF-8 is always used internally to encode characters. + This applies to all the places where text is used, including buffers (files + loaded into memory), registers and variables. *charset* *codeset* Charset is another name for encoding. There are subtle differences, but these @@ -240,7 +234,7 @@ matter what language is used. Thus you might see the right text even when the encoding was set wrong. *encoding-names* -Vim can use many different character encodings. There are three major groups: +Vim can edit files in different character encodings. There are three major groups: 1 8bit Single-byte encodings, 256 different characters. Mostly used in USA and Europe. Example: ISO-8859-1 (Latin1). All @@ -255,11 +249,10 @@ u Unicode Universal encoding, can replace all others. ISO 10646. Millions of different characters. Example: UTF-8. The relation between bytes and screen cells is complex. -Other encodings cannot be used by Vim internally. But files in other +Only UTF-8 is used by Vim internally. But files in other encodings can be edited by using conversion, see 'fileencoding'. -Note that all encodings must use ASCII for the characters up to 128. -Supported 'encoding' values are: *encoding-values* +Recognized 'fileencoding' values include: *encoding-values* 1 latin1 8-bit characters (ISO 8859-1, also used for cp1252) 1 iso-8859-n ISO_8859 variant (n = 2 to 15) 1 koi8-r Russian @@ -311,11 +304,11 @@ u ucs-4 32 bit UCS-4 encoded Unicode (ISO/IEC 10646-1) u ucs-4le like ucs-4, little endian The {name} can be any encoding name that your system supports. It is passed -to iconv() to convert between the encoding of the file and the current locale. +to iconv() to convert between UTF-8 and the encoding of the file. For MS-Windows "cp{number}" means using codepage {number}. Examples: > - :set encoding=8bit-cp1252 - :set encoding=2byte-cp932 + :set fileencoding=8bit-cp1252 + :set fileencoding=2byte-cp932 The MS-Windows codepage 1252 is very similar to latin1. For practical reasons the same encoding is used and it's called latin1. 'isprint' can be used to @@ -337,8 +330,7 @@ u ucs-2be same as ucs-2 (big endian) u ucs-4be same as ucs-4 (big endian) u utf-32 same as ucs-4 u utf-32le same as ucs-4le - default stands for the default value of 'encoding', depends on the - environment + default the encoding of the current locale. For the UCS codes the byte order matters. This is tricky, use UTF-8 whenever you can. The default is to use big-endian (most significant byte comes @@ -363,13 +355,12 @@ or when conversion is not possible: CONVERSION *charset-conversion* Vim will automatically convert from one to another encoding in several places: -- When reading a file and 'fileencoding' is different from 'encoding' -- When writing a file and 'fileencoding' is different from 'encoding' +- When reading a file and 'fileencoding' is different from "utf-8" +- When writing a file and 'fileencoding' is different from "utf-8" - When displaying messages and the encoding used for LC_MESSAGES differs from - 'encoding' (requires a gettext version that supports this). + "utf-8" (requires a gettext version that supports this). - When reading a Vim script where |:scriptencoding| is different from - 'encoding'. -- When reading or writing a |shada| file. + "utf-8". Most of these require the |+iconv| feature. Conversion for reading and writing files may also be specified with the 'charconvert' option. @@ -408,11 +399,11 @@ Useful utilities for converting the charset: *mbyte-conversion* -When reading and writing files in an encoding different from 'encoding', +When reading and writing files in an encoding different from "utf-8", conversion needs to be done. These conversions are supported: - All conversions between Latin-1 (ISO-8859-1), UTF-8, UCS-2 and UCS-4 are handled internally. -- For MS-Windows, when 'encoding' is a Unicode encoding, conversion from and +- For MS-Windows, conversion from and to any codepage should work. - Conversion specified with 'charconvert' - Conversion with the iconv library, if it is available. @@ -468,8 +459,6 @@ and you will have a working UTF-8 terminal emulator. Try both > with the demo text that comes with ucs-fonts.tar.gz in order to see whether there are any problems with UTF-8 in your xterm. -For Vim you may need to set 'encoding' to "utf-8". - ============================================================================== 5. Fonts on X11 *mbyte-fonts-X11* @@ -860,15 +849,16 @@ text, you can use the 'keymap' option. This will translate one or more (English) characters to another (non-English) character. This only happens when typing text, not when typing Vim commands. This avoids having to switch between two keyboard settings. +{only available when compiled with the |+keymap| feature} The value of the 'keymap' option specifies a keymap file to use. The name of this file is one of these two: - keymap/{keymap}_{encoding}.vim + keymap/{keymap}_utf-8.vim keymap/{keymap}.vim -Here {keymap} is the value of the 'keymap' option and {encoding} of the -'encoding' option. The file name with the {encoding} included is tried first. +Here {keymap} is the value of the 'keymap' option. +The file name with "utf-8" included is tried first. 'runtimepath' is used to find these files. To see an overview of all available keymap files, use this: > @@ -950,7 +940,7 @@ this is unusual. But you can use various ways to specify the character: > A <char-0141> octal value x <Space> special key name -The characters are assumed to be encoded for the current value of 'encoding'. +The characters are assumed to be encoded in UTF-8. It's possible to use ":scriptencoding" when all characters are given literally. That doesn't work when using the <char-> construct, because the conversion is done on the keymap file, not on the resulting character. @@ -1170,21 +1160,13 @@ Useful commands: message is truncated, use ":messages"). - "g8" shows the bytes used in a UTF-8 character, also the composing characters, as hex numbers. -- ":set encoding=utf-8 fileencodings=" forces using UTF-8 for all files. The - default is to use the current locale for 'encoding' and set 'fileencodings' - to automatically detect the encoding of a file. +- ":set fileencodings=" forces using UTF-8 for all files. The + default is to automatically detect the encoding of a file. STARTING VIM -If your current locale is in an utf-8 encoding, Vim will automatically start -in utf-8 mode. - -If you are using another locale: > - - set encoding=utf-8 - -You might also want to select the font used for the menus. Unfortunately this +You might want to select the font used for the menus. Unfortunately this doesn't always work. See the system specific remarks below, and 'langmenu'. @@ -1245,10 +1227,9 @@ not everybody is able to type a composing character. These options are relevant for editing multi-byte files. Check the help in options.txt for detailed information. -'encoding' Encoding used for the keyboard and display. It is also the - default encoding for files. +'encoding' Internal text encoding, always "utf-8". -'fileencoding' Encoding of a file. When it's different from 'encoding' +'fileencoding' Encoding of a file. When it's different from "utf-8" conversion is done when reading or writing the file. 'fileencodings' List of possible encodings of a file. When opening a file diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 114bb61d99..fd66a5dafb 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 7.4. Last change: 2013 Feb 23 +*message.txt* For Vim version 7.4. Last change: 2016 Jul 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,6 +19,15 @@ The ":messages" command can be used to view previously given messages. This is especially useful when messages have been overwritten or truncated. This depends on the 'shortmess' option. + :messages Show all messages. + + :{count}messages Show the {count} most recent messages. + + :messages clear Clear all messages. + + :{count}messages clear Clear messages, keeping only the {count} most + recent ones. + The number of remembered messages is fixed at 20 for the tiny version and 200 for other versions. @@ -58,9 +67,9 @@ If you are lazy, it also works without the shift key: > When an error message is displayed, but it is removed before you could read it, you can see it again with: > :echo errmsg -or view a list of recent messages with: > +Or view a list of recent messages with: > :messages - +See `:messages` above. LIST OF MESSAGES *E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317* @@ -656,6 +665,12 @@ You must be using an awful lot of buffers. It's now possible that two buffers have the same number, which causes various problems. You might want to exit Vim and restart it. + *E931* > + Buffer cannot be registered + +Out of memory or a duplicate buffer number. May habben after W14. Looking up +a buffer will not always work, better restart Vim. + *E296* *E297* > Seek error in swap file write Write error in swap file diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt index 5f4642274c..a2be3cfd49 100644 --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -1,4 +1,4 @@ -*mlang.txt* For Vim version 7.4. Last change: 2012 Jan 15 +*mlang.txt* For Vim version 7.4. Last change: 2016 Jan 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -94,13 +94,15 @@ If you used the self-installing .exe file, message translations should work already. Otherwise get the libintl.dll file if you don't have it yet: http://sourceforge.net/projects/gettext +Or: + https://mlocati.github.io/gettext-iconv-windows/ This also contains tools xgettext, msgformat and others. libintl.dll should be placed in same directory with (g)vim.exe, or some -place where PATH environment value describe. Message files (vim.mo) -have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", where "xx" is the -abbreviation of the language (mostly two letters). +place where PATH environment value describe. Vim also finds libintl-8.dll. +Message files (vim.mo) have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", +where "xx" is the abbreviation of the language (mostly two letters). If you write your own translations you need to generate the .po file and convert it to a .mo file. You need to get the source distribution and read diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 7f84f2d2a3..606fd53fee 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1,4 +1,4 @@ -*motion.txt* For Vim version 7.4. Last change: 2015 Jun 06 +*motion.txt* For Vim version 7.4. Last change: 2016 Jul 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -569,7 +569,7 @@ i[ "inner [] block", select [count] '[' ']' blocks. This When used in Visual mode it is made characterwise. a) *v_a)* *a)* *a(* -a( *v_ab* *v_a(* *ab* +a( *vab* *v_ab* *v_a(* *ab* ab "a block", select [count] blocks, from "[count] [(" to the matching ')', including the '(' and ')' (see |[(|). Does not include white space outside of the @@ -577,7 +577,7 @@ ab "a block", select [count] blocks, from "[count] [(" to When used in Visual mode it is made characterwise. i) *v_i)* *i)* *i(* -i( *v_ib* *v_i(* *ib* +i( *vib* *v_ib* *v_i(* *ib* ib "inner block", select [count] blocks, from "[count] [(" to the matching ')', excluding the '(' and ')' (see |[(|). @@ -1013,6 +1013,9 @@ CTRL-I Go to [count] newer cursor position in jump list *:ju* *:jumps* :ju[mps] Print the jump list (not a motion command). + *:cle* *:clearjumps* +:cle[arjumps] Clear the jump list of the current window. + *jumplist* Jumps are remembered in a jump list. With the CTRL-O and CTRL-I command you can go to cursor positions before older jumps, and back again. Thus you can diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index bafb9dfc2c..c074eb43ff 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -1,97 +1,93 @@ -*msgpack_rpc.txt* For Nvim. {Nvim} +*msgpack_rpc.txt* {Nvim} NVIM REFERENCE MANUAL by Thiago de Arruda -The Msgpack-RPC Interface to Nvim *msgpack-rpc* +RPC API for Nvim *RPC* *rpc* *msgpack-rpc* -1. Introduction |msgpack-rpc-intro| -2. API mapping |msgpack-rpc-api| -3. Connecting |msgpack-rpc-connecting| -4. Clients |msgpack-rpc-clients| -5. Types |msgpack-rpc-types| -6. Wrapping methods |msgpack-rpc-wrap-methods| -7. Vimscript functions |msgpack-rpc-vim-functions| +1. Introduction |rpc-intro| +2. API mapping |rpc-api| +3. Connecting |rpc-connecting| +4. Clients |rpc-api-client| +5. Types |rpc-types| +6. Remote UIs |rpc-remote-ui| ============================================================================== -1. Introduction *msgpack-rpc-intro* +1. Introduction *rpc-intro* -The primary way to control a running Nvim instance is through -MessagePack-RPC, a messaging protocol that uses the MessagePack serialization -format: https://github.com/msgpack/msgpack/blob/7498cf3/spec.md. -From now on, we refer to the protocol as msgpack-rpc. +The primary way to control Nvim programmatically is the RPC API, which speaks +MessagePack-RPC ("msgpack-rpc"), a messaging protocol that uses the +MessagePack serialization format: + https://github.com/msgpack/msgpack/blob/0b8f5ac/spec.md -At this point, only plugins use msgpack-rpc, but eventually even user -interaction will happen through it, since user interfaces will be separate -programs that control a headless Nvim instance. +All kinds of Nvim "clients" use the RPC API: user interfaces (GUIs), remote +plugins, scripts like "nvr" (https://github.com/mhinz/neovim-remote), and even +`nvim` itself can control other `nvim` instances. By connecting to the RPC API +programs can: -By connecting to the msgpack-rpc interface, programs can: + - Call any API function + - Listen for events + - Receive remote calls from Nvim -- Call any Nvim API function -- Listen for Nvim events -- Receive remote calls from Nvim - -Nvim's msgpack-rpc interface is like a more powerful version of Vim's -`clientserver` feature. +The RPC API is like a more powerful version of Vim's `clientserver` feature. ============================================================================== -2. API mapping *msgpack-rpc-api* + 2. API mapping *rpc-api* -The Nvim C API, see |nvim-api|, is automatically exposed to the msgpack-rpc -interface by the build system, which parses headers at src/nvim/api from the -project root. A dispatch function is generated, which matches msgpack-rpc method -names with non-static API functions, converting/validating arguments and return -values back to msgpack. +The Nvim C |API| is automatically exposed to the RPC API by the build system, +which parses headers at src/nvim/api/*. A dispatch function is generated which +matches RPC API method names with public API functions, converting/validating +arguments and return values back to msgpack. -Client libraries will normally provide wrappers that hide msgpack-rpc details -from programmers. The wrappers can be automatically generated by reading -bundled API metadata from a compiled Nvim instance. +Client libraries (|api-client|s) normally provide wrappers that hide +msgpack-rpc details from application developers. The wrappers can be +automatically generated by reading bundled API metadata from a compiled Nvim +instance. -There are two ways to obtain API metadata: +There are three ways to obtain API metadata: -1. By connecting to a running Nvim instance and calling `vim_get_api_info` - via msgpack-rpc. This is best for clients written in dynamically-typed - languages, which can define functions at runtime. + 1. Connect to a running Nvim instance and call `nvim_get_api_info` via + msgpack-rpc. This is best for clients written in dynamic languages which + can define functions at runtime. -2. By starting Nvim with the `--api-info` command-line option, which makes Nvim - dump a blob of msgpack metadata to standard output and exit. This is best - for clients written in statically-typed languages, which require a separate - compilation step. + 2. Start Nvim with the |--api-info| option. Useful for clients written in + statically-compiled languages. -Here's a simple way to get human-readable description of the API (requires -Python and the `pyyaml`/`msgpack-python` pip packages): -> - nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))' > api.yaml + 3. Use the |api_info()| vimscript function. + +To get a human-readable list of API functions: > + :new|put =map(api_info().functions, 'v:val.name') +< +To get a formatted dump of the API using python (requires the `pyyaml` and +`msgpack-python` packages): > + nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))' < ============================================================================== -3. Connecting *msgpack-rpc-connecting* +3. Connecting *rpc-connecting* -There are four ways to open msgpack-rpc streams to Nvim: +There are several ways to open a msgpack-rpc channel to an Nvim instance: -1. Through Nvim's stdin/stdout when it's started with the `--embed` option. - This is how other programs can embed Nvim. + 1. Through stdin/stdout when `nvim` is started with `--embed`. This is how + applications can embed Nvim. -2. Through the stdin/stdout of a program spawned by the |rpcstart()| function. + 2. Through stdin/stdout of some other process spawned by |jobstart()|. + Set the "rpc" key to |v:true| in the options dict to use the job's stdin + and stdout as a single msgpack channel that is processed directly by + Nvim. Then it is not possible to process raw data to or from the + process's stdin and stdout. stderr can still be used, though. - *$NVIM_LISTEN_ADDRESS* -3. Through the socket automatically created with each instance. To get the - socket location for a running Nvim instance (which is random by default), - see the |$NVIM_LISTEN_ADDRESS| environment variable: -> - :echo $NVIM_LISTEN_ADDRESS -< - See also |v:servername|. + 3. Through the socket automatically created with each instance. The socket + location is stored in |v:servername|. -4. Through a TCP/IP socket. To make Nvim listen on a TCP/IP socket, set the - |$NVIM_LISTEN_ADDRESS| environment variable in a shell before starting Nvim: -> + 4. Through a TCP/IP socket. To make Nvim listen on a TCP/IP socket, set the + |$NVIM_LISTEN_ADDRESS| environment variable before starting Nvim: > NVIM_LISTEN_ADDRESS=127.0.0.1:6666 nvim < -Connecting to the socket is the easiest way a programmer can test the API, which -can be done through any msgpack-rpc client library or fully-featured Nvim client -(which we'll see in the next section). Here's a Ruby script that prints 'hello -world!' in the current Nvim instance: +Connecting to the socket is the easiest way a programmer can test the API, +which can be done through any msgpack-rpc client library or full-featured +|api-client|. Here's a Ruby script that prints 'hello world!' in the current +Nvim instance: > #!/usr/bin/env ruby # Requires msgpack-rpc: gem install msgpack-rpc @@ -109,7 +105,7 @@ world!' in the current Nvim instance: require 'msgpack/rpc/transport/unix' nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM_LISTEN_ADDRESS']) - result = nvim.call(:vim_command, 'echo "hello world!"') + result = nvim.call(:nvim_command, 'echo "hello world!"') < A better way is to use the Python REPL with the `neovim` package, where API functions can be called interactively: @@ -118,72 +114,110 @@ functions can be called interactively: >>> nvim = attach('socket', path='[address]') >>> nvim.command('echo "hello world!"') < -One can also spawn and connect to an embedded Nvim instance via |rpcstart()| +You can also embed an Nvim instance via |jobstart()|, and communicate using +|rpcrequest()| and |rpcnotify()|: > - let vim = rpcstart('nvim', ['--embed']) - echo rpcrequest(vim, 'vim_eval', '"Hello " . "world!"') - call rpcstop(vim) + let nvim = jobstart(['nvim', '--embed'], {'rpc': v:true}) + echo rpcrequest(nvim, 'nvim_eval', '"Hello " . "world!"') + call jobstop(nvim) < ============================================================================== -4. Implementing new clients *msgpack-rpc-clients* - -Nvim is still in alpha, so there's no in-depth documentation explaining how to -properly implement a client library yet. The Python client (the pip package -"neovim") will always be up-to-date with the latest API changes, so its source -code is the best documentation currently available. There are some guidelines -however: - -- Separate the transport layer from the rest of the library. See - |msgpack-rpc-connecting| for details on how clients can connect to Nvim. -- Use a MessagePack library that implements at least version 5 of the - MessagePack spec, which supports the `bin` and `ext` types used by Nvim. -- Read API metadata in order to create client-side wrappers for all - msgpack-rpc methods. -- Use a single-threaded event loop library/pattern. -- Use a fiber/coroutine library for the language being used for implementing a - client. These greatly simplify concurrency and allow the library to expose a - blocking API on top of a non-blocking event loop without the complexity that - comes with preemptive multitasking. -- Don't assume anything about the order that responses to msgpack-rpc requests - will arrive. -- Clients should expect msgpack-rpc requests, which need to be handled - immediately because Nvim is blocked while waiting for the client response. -- Clients should expect to receive msgpack-rpc notifications, but these don't - need to be handled immediately because they won't block Nvim (although they - should probably be handled immediately anyway). - -Most of the complexity could be handled by a msgpack-rpc library that supports -server to client requests and notifications, but it's not clear if this is part -of the msgpack-rpc spec. At least the Ruby msgpack-rpc library does not seem -to support it: - +4. Implementing API clients *rpc-api-client* *api-client* + +"API clients" wrap the Nvim API to provide idiomatic "SDKs" for their +respective platforms (see |dev-jargon|). You can build a new API client for +your favorite platform or programming language. + +Existing API clients are listed here: + https://github.com/neovim/neovim/wiki/Related-projects#api-clients + +The Python client is the reference implementation for API clients. It is +always up-to-date with the Nvim API, so its source code and test suite are +authoritative references. + https://github.com/neovim/python-client + +API client implementation guidelines ~ + + - Separate the transport layer from the rest of the library. See + |rpc-connecting| for details on how clients can connect to Nvim. + - Use a MessagePack library that implements at least version 5 of the + MessagePack spec, which supports the `bin` and `ext` types used by Nvim. + - Read API metadata in order to create client-side wrappers for all + msgpack-rpc methods. + - Use a single-threaded event loop library/pattern. + - Use a fiber/coroutine library for the language being used for implementing + a client. These greatly simplify concurrency and allow the library to + expose a blocking API on top of a non-blocking event loop without the + complexity that comes with preemptive multitasking. + - Don't assume anything about the order that responses to msgpack-rpc + requests will arrive. + - Clients should expect msgpack-rpc requests, which need to be handled + immediately because Nvim is blocked while waiting for the client response. + - Clients should expect to receive msgpack-rpc notifications, but these + don't need to be handled immediately because they won't block Nvim + (although they should probably be handled immediately anyway). + +Note: Most of the complexity could be handled by a msgpack-rpc library that +supports server to client requests and notifications, but it's not clear if +this is part of the msgpack-rpc spec. At least the Ruby msgpack-rpc library +does not seem to support it: https://github.com/msgpack-rpc/msgpack-rpc-ruby/blob/master/lib/msgpack/rpc/transport/tcp.rb#L150-L158 +API metadata object ~ + +API clients exist to hide msgpack-rpc details. The API metadata object +contains information that makes this task easier (see also |rpc-types|): + + - The "version" key contains the Nvim version, API level, and API + backwards-compatibility level. + - The "functions" key contains a list of metadata objects for individual + functions. + - Each function metadata object has |rpc-types| information about the return + value and parameters. These can be used for generating strongly-typed APIs + in static languages. + - Container types may be decorated with type/size constraints, e.g. + ArrayOf(Buffer) or ArrayOf(Integer, 2). This can be useful to generate + even more strongly-typed APIs. + - Functions that are considered to be methods that operate on instances of + Nvim special types (msgpack EXT) will have the `"method"` attribute set to + `true`. The reciever type is the type of the first argument. The method + names are prefixed with `nvim_` plus a shortened type name, e.g. + `nvim_buf_get_lines` represents the `get_lines` method of a Buffer instance. + - Global functions have `"method"` set to `false` and are prefixed with just + `nvim_`, e.g. `nvim_get_buffers`. + +So for an object-oriented language, an API client contains the classes +representing Nvim special types, and the methods of each class could be +defined by stripping the prefix for the type as defined in the `types` metadata +(this will always be the first two "_"-separated parts of the function name). +There could also be a singleton Vim class with methods where the `nvim_` +prefix is stripped off. + ============================================================================== -5. Types *msgpack-rpc-types* +5. Types *rpc-types* -Nvim's C API uses custom types for all functions, se |nvim-api-types|. -For the purpose of mapping to msgpack, he types can be split into two groups: +The Nvim C API uses custom types for all functions. |api-types| +For the purpose of mapping to msgpack, the types can be split into two groups: -- Basic types that map natively to msgpack (and probably have a default - representation in msgpack-supported programming languages) -- Special Nvim types that map to msgpack EXT with custom type codes. + - Basic types that map natively to msgpack (and probably have a default + representation in msgpack-supported programming languages) + - Special Nvim types that map to msgpack EXT with custom type codes. -Basic type mapping: +Basic types ~ -Nil -> msgpack nil -Boolean -> msgpack boolean -Integer (signed 64-bit integer) -> msgpack integer -Float (IEEE 754 double precision) -> msgpack float -String -> msgpack string -Array -> msgpack array -Dictionary -> msgpack map + Nil -> msgpack nil + Boolean -> msgpack boolean + Integer (signed 64-bit integer) -> msgpack integer + Float (IEEE 754 double precision) -> msgpack float + String -> msgpack string + Array -> msgpack array + Dictionary -> msgpack map -Special Nvim types that use msgpack EXT: +Special types (msgpack EXT) ~ -Buffer -> enum value kObjectTypeBuffer -Window -> enum value kObjectTypeWindow -Tabpage -> enum value kObjectTypeTabpage + Buffer -> enum value kObjectTypeBuffer + Window -> enum value kObjectTypeWindow + Tabpage -> enum value kObjectTypeTabpage An API method expecting one of these types may be passed an integer instead, although they are not interchangeable. For example, a Buffer may be passed as @@ -191,70 +225,193 @@ an integer, but not a Window or Tabpage. The most reliable way of determining the type codes for the special Nvim types is to inspect the `types` key of metadata dictionary returned by the -`vim_get_api_info` method at runtime. Here's an example JSON representation of +`nvim_get_api_info` method at runtime. Here's a sample JSON representation of the `types` object: > "types": { "Buffer": { - "id": 0 + "id": 0, + "prefix": "nvim_buf_" }, "Window": { - "id": 1 + "id": 1, + "prefix": "nvim_win_" }, "Tabpage": { - "id": 2 + "id": 2, + "prefix": "nvim_tabpage_" } } < -Even for statically compiled clients, it's a good practice to avoid hardcoding -the type codes, because a client may be built against one Nvim version but connect -to another with different type codes. - -============================================================================== -6. Wrapping methods *msgpack-rpc-wrap-methods* - -As mentioned before, clients should provide an API that hides msgpack-rpc -details from programmers, and the API metadata object contains information -that makes this task easier: - -- The "functions" key contains a list of metadata objects for individual - functions. -- Each function metadata object has type information about the return value - and parameters. These can be used for generating strongly-typed APIs in - static languages. -- Container types may be decorated with type/size constraints, e.g. - ArrayOf(Buffer) or ArrayOf(Integer, 2). This can be useful to generate even - more strongly-typed APIs. -- Methods that operate instances of Nvim's types are prefixed with the type - name in lower case, e.g. `buffer_get_line` represents the `get_line` method - of a Buffer instance. -- Global methods are prefixed with `vim`, e.g. `vim_get_buffers`. - -So, for an object-oriented language, a client library would have the classes -that represent Nvim's types, and the methods of each class could be defined -by inspecting the method name prefix. There could also be a singleton Vim -class with methods mapped to functions prefixed with `vim_` +Even for statically compiled clients it is good practice to avoid hardcoding +the type codes, because a client may be built against one Nvim version but +connect to another with different type codes. ============================================================================== -7. Vimscript functions *msgpack-rpc-vim-functions* - -Four msgpack-rpc functions are available in Vimscript: - -1. |rpcstart()|: Similarly to |jobstart()|, this will spawn a co-process with - its standard handles connected to Nvim. The difference is that it's not - possible to process raw data to or from the process's stdin, stdout, or - stderr. This is because the job's stdin and stdout are used as a single - msgpack channel that is processed directly by Nvim. - -2. |rpcstop()|: Same as |jobstop()|, but operates on handles returned by - |rpcstart()|. - -3. |rpcrequest()|: Sends a msgpack-rpc request to the process. - -4. |rpcnotify()|: Sends a msgpack-rpc notification to the process. - -The last two functions may also be used with channels created from -connections to |$NVIM_LISTEN_ADDRESS|. +6. Remote UIs *rpc-remote-ui* + +Nvim allows Graphical user interfaces to be implemented by separate processes +communicating with Nvim over the RPC API. Currently the ui model conists of a +terminal-like grid with one single, monospace font size, with a few elements +that could be drawn separately from the grid (for the momemnt only the popup +menu) + +After connecting to a nvim instance (typically a spawned, embedded instance) +use the |nvim_ui_attach|(width, height, options) API method to tell nvim that your +program wants to draw the nvim screen on a grid with "width" times +"height" cells. "options" should be a dictionary with the following (all +optional) keys: + `rgb`: Controls what color format to use. + Set to true (default) to use 24-bit rgb + colors. + Set to false to use terminal color codes (at + most 256 different colors). + `popupmenu_external`: Instead of drawing the completion popupmenu on + the grid, Nvim will send higher-level events to + the ui and let it draw the popupmenu. + Defaults to false. + +Nvim will then send msgpack-rpc notifications, with the method name "redraw" +and a single argument, an array of screen updates (described below). +These should be processed in order. Preferably the user should only be able to +see the screen state after all updates are processed (not any intermediate +state after processing only a part of the array). + +Screen updates are arrays. The first element a string describing the kind +of update. + +["resize", width, height] + The grid is resized to `width` and `height` cells. + +["clear"] + Clear the screen. + +["eol_clear"] + Clear from the cursor position to the end of the current line. + +["cursor_goto", row, col] + Move the cursor to position (row, col). Currently, the same cursor is + used to define the position for text insertion and the visible cursor. + However, only the last cursor position, after processing the entire + array in the "redraw" event, is intended to be a visible cursor + position. + +["update_fg", color] +["update_bg", color] +["update_sp", color] + Set the default foreground, background and special colors + respectively. + +["highlight_set", attrs] + Set the attributes that the next text put on the screen will have. + `attrs` is a dict with the keys below. Any absent key is reset + to its default value. Color defaults are set by the `update_fg` etc + updates. All boolean keys default to false. + + `foreground`: foreground color. + `background`: backround color. + `special`: color to use for underline and undercurl, when present. + `reverse`: reverse video. Foreground and background colors are + switched. + `italic`: italic text. + `bold`: bold text. + `underline`: underlined text. The line has `special` color. + `undercurl`: undercurled text. The curl has `special` color. + +["put", text] + The (utf-8 encoded) string `text` is put at the cursor position + (and the cursor is advanced), with the highlights as set by the + last `highlight_set` update. + +["set_scroll_region", top, bot, left, right] + Define the scroll region used by `scroll` below. + +["scroll", count] + Scroll the text in the scroll region. The diagrams below illustrate + what will happen, depending on the scroll direction. "=" is used to + represent the SR(scroll region) boundaries and "-" the moved rectangles. + Note that dst and src share a common region. + + If count is bigger than 0, move a rectangle in the SR up, this can + happen while scrolling down. +> + +-------------------------+ + | (clipped above SR) | ^ + |=========================| dst_top | + | dst (still in SR) | | + +-------------------------+ src_top | + | src (moved up) and dst | | + |-------------------------| dst_bot | + | src (cleared) | | + +=========================+ src_bot +< + If count is less than zero, move a rectangle in the SR down, this can + happen while scrolling up. +> + +=========================+ src_top + | src (cleared) | | + |------------------------ | dst_top | + | src (moved down) and dst| | + +-------------------------+ src_bot | + | dst (still in SR) | | + |=========================| dst_bot | + | (clipped below SR) | v + +-------------------------+ +< +["set_title", title] +["set_icon", icon] + Set the window title, and icon (minimized) window title, respectively. + In windowing systems not distinguishing between the two, "set_icon" + can be ignored. + +["mouse_on"] +["mouse_off"] + Tells the client whether mouse support, as determined by |'mouse'| + option, is considered to be active in the current mode. This is mostly + useful for a terminal frontend, or other situations where nvim mouse + would conflict with other usages of the mouse. It is safe for a client + to ignore this and always send mouse events. + +["busy_on"] +["busy_off"] + Nvim started or stopped being busy, and possibly not responsible to user + input. This could be indicated to the user by hiding the cursor. + +["suspend"] + |:suspend| command or |Ctrl-Z| mapping is used. A terminal client (or other + client where it makes sense) could suspend itself. Other clients can + safely ignore it. + +["bell"] +["visual_bell"] + Notify the user with an audible or visual bell, respectively. + +["update_menu"] + The menu mappings changed. + +["mode_change", mode] + The mode changed. Currently sent when "insert", "replace", "cmdline" and + "normal" modes are entered. A client could for instance change the cursor + shape. + +["popupmenu_show", items, selected, row, col] + When `popupmenu_external` is set to true, nvim will not draw the + popupmenu on the grid, instead when the popupmenu is to be displayed + this update is sent. `items` is an array of the items to show, the + items are themselves arrays of the form [word, kind, menu, info] + as defined at |complete-items|, except that `word` is replaced by + `abbr` if present. `selected` is the initially selected item, either a + zero-based index into the array of items, or -1 if no item is + selected. `row` and `col` is the anchor position, where the first + character of the completed word will be. + +["popupmenu_select", selected] + An item in the currently displayed popupmenu is selected. `selected` + is either a zero-based index into the array of items from the last + `popupmenu_show` event, or -1 if no item is selected. + +["popupmenu_hide"] + The popupmenu is hidden. ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/nvim.txt b/runtime/doc/nvim.txt index a7c512d1dc..7dfbbd0cf0 100644 --- a/runtime/doc/nvim.txt +++ b/runtime/doc/nvim.txt @@ -1,24 +1,59 @@ -*nvim.txt* For Nvim. {Nvim} +*nvim.txt* {Nvim} - NVIM REFERENCE MANUAL *nvim* + NVIM REFERENCE MANUAL -Introduction to Nvim *nvim-intro* +Nvim *nvim* *nvim-intro* -This is an introduction for Vim users who are just getting started with Nvim. -It is not meant for Vim beginners. For a basic introduction to Vim, -see |help.txt|. +If you are new to Vim (and Nvim) see |help.txt| or type ":Tutor". +If you already use Vim (but not Nvim) see |nvim-from-vim| for a quickstart. -1. Transitioning from Vim |nvim-from-vim| -2. Differences from Vim |vim-differences| -3. Msgpack-RPC |msgpack-rpc| -4. Job control |job-control| -5. Python plugins |nvim-python| -6. Clipboard integration |nvim-clipboard| -7. Remote plugins |remote-plugin| -8. Provider infrastructure |nvim-provider| -9. Integrated terminal emulator |nvim-terminal-emulator| +Nvim is emphatically a fork of Vim, not a clone: compatibility with Vim is +maintained where possible. See |vim_diff.txt| for the complete reference of +differences from Vim. + +============================================================================== +Transitioning from Vim *nvim-from-vim* + +To start the transition, link your previous configuration so Nvim can use it: +> + mkdir ~/.config + ln -s ~/.vim ~/.config/nvim + ln -s ~/.vimrc ~/.config/nvim/init.vim +< +Note: If your system sets `$XDG_CONFIG_HOME`, use that instead of `~/.config` +in the code above. Nvim follows the XDG |base-directories| convention. + +See |provider-python| and |provider-clipboard| for additional software you +might need to use some features. + +Your Vim configuration might not be entirely compatible with Nvim. For a +full list of differences between Vim and Nvim see |vim-differences|. + +The |'ttymouse'| option, for example, was removed from Nvim (mouse support +should work without it). If you use the same |vimrc| for Vim and Nvim, +consider guarding |'ttymouse'| in your configuration like so: +> + if !has('nvim') + set ttymouse=xterm2 + endif +< +Conversely, if you have Nvim specific configuration items, you could do +this: +> + if has('nvim') + tnoremap <Esc> <C-\><C-n> + endif +< +For a more granular approach use |exists()|: +> + if exists(':tnoremap') + tnoremap <Esc> <C-\><C-n> + endif +< +Now you should be able to explore Nvim more comfortably. Check |nvim-features| +for more information. ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/nvim_clipboard.txt b/runtime/doc/nvim_clipboard.txt deleted file mode 100644 index 078382c7a7..0000000000 --- a/runtime/doc/nvim_clipboard.txt +++ /dev/null @@ -1,63 +0,0 @@ -*nvim_clipboard.txt* For Nvim. {Nvim} - - - NVIM REFERENCE MANUAL by Thiago de Arruda - - -Clipboard integration for Nvim *nvim-clipboard* - -1. Intro |nvim-clipboard-intro| -2. X11 selection mechanism |nvim-clipboard-x11| - -============================================================================== -1. Intro *nvim-clipboard-intro* - -Nvim has no direct connection to the system clipboard. Instead, it is -accessible through the |nvim-provider| infrastructure, which transparently -uses shell commands for communicating with the clipboard. - -Clipboard access is implicitly enabled if any of the following clipboard tools -is found in your `$PATH`. - -- xclip -- xsel (newer alternative to xclip) -- pbcopy/pbpaste (only for Mac OS X) -- lemonade (useful for SSH machine) - https://github.com/pocke/lemonade -- doitclient (another option for SSH setups from the maintainer of PuTTY) - http://www.chiark.greenend.org.uk/~sgtatham/doit/ - -The presence of a suitable clipboard tool implicitly enables the '+' and '*' -registers. - -If you want to ALWAYS use the clipboard for ALL operations (as opposed -to interacting with the '+' and/or '*' registers explicitly), set the -following option: -> - set clipboard+=unnamedplus -< -See 'clipboard' for details and more options. - -============================================================================== -2. X11 selection mechanism *nvim-clipboard-x11* *x11-selection* - -The clipboard providers for X11 store text in what is known as "selections". -Selections are "owned" by an application, so when the application is closed, -the selection text is lost. - -The contents of selections are held by the originating application (e.g., upon -a copy), and only passed on to another application when that other application -asks for them (e.g., upon a paste). - - *quoteplus* *quote+* - -There are three documented X11 selections: `PRIMARY`, `SECONDARY`, and `CLIPBOARD`. -`CLIPBOARD` is typically used in X11 applications for copy/paste operations -(`Ctrl-c`/`v`), while `PRIMARY` is used for the last selected text, which is -generally inserted with the middle mouse button. - -Nvim's X11 clipboard providers only utilize the `PRIMARY` and `CLIPBOARD` -selections, used for the '*' and '+' registers, respectively. - -============================================================================== - vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/nvim_from_vim.txt b/runtime/doc/nvim_from_vim.txt deleted file mode 100644 index 299eeb05f5..0000000000 --- a/runtime/doc/nvim_from_vim.txt +++ /dev/null @@ -1,50 +0,0 @@ -*nvim_from_vim.txt* For Nvim. {Nvim} - - - NVIM REFERENCE MANUAL - - -Transitioning from Vim *nvim-from-vim* - -Nvim is emphatically a fork of Vim, so compatibility to Vim should be pretty -good. - -To start the transition, link your previous configuration so Nvim can use -it: -> - mkdir -p ${XDG_CONFIG_HOME:=$HOME/.config} - ln -s ~/.vim $XDG_CONFIG_HOME/nvim - ln -s ~/.vimrc $XDG_CONFIG_HOME/nvim/init.vim -< -See |nvim-intro|, especially |nvim-python| and |nvim-clipboard|, for -additional software you might need to install to use all of Nvim's features. - -Your Vim configuration might not be entirely compatible with Nvim. For a -full list of differences between Vim and Nvim, see |vim-differences|. - -The |'ttymouse'| option, for example, was removed from Nvim (mouse support -should work without it). If you use the same |vimrc| for Vim and Nvim, -consider guarding |'ttymouse'| in your configuration like so: -> - if !has('nvim') - set ttymouse=xterm2 - endif -< -Conversely, if you have Nvim specific configuration items, you could do -this: -> - if has('nvim') - tnoremap <Esc> <C-\><C-n> - endif -< -For a more granular approach, use |exists()|: -> - if exists(':tnoremap') - tnoremap <Esc> <C-\><C-n> - endif -< -Now you should be able to explore Nvim more comfortably. Check |nvim| for more -information. - -============================================================================== - vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/nvim_provider.txt b/runtime/doc/nvim_provider.txt deleted file mode 100644 index 91cd5fbfc7..0000000000 --- a/runtime/doc/nvim_provider.txt +++ /dev/null @@ -1,76 +0,0 @@ -*nvim_provider.txt* For Nvim. {Nvim} - - - NVIM REFERENCE MANUAL by Thiago de Arruda - - -Nvim provider infrastructure *nvim-provider* - -First of all, this document is meant to be read by developers interested in -contributing to the refactoring effort. If you are a normal user or plugin -developer looking to learn about Nvim |msgpack-rpc| infrastructure for -implementing plugins in other programming languages, see |remote-plugin|. -For instructions on how to enable Python plugins, see |nvim-python|. For -clipboard, see |nvim-clipboard|. - -Instead of doing everything by itself, Nvim aims to simplify its own -maintenance by delegating as much work as possible to external systems. But -some Vim components are too tightly coupled and in some cases the refactoring -work necessary to swap in-house implementations by code that integrates to -other systems is too great. Nvim provider infrastructure is a facility that -aims to make this task simpler. - -To understand why the provider infrastructure is useful, let us consider two -examples of integration with external systems that are implemented in Vim and -are now decoupled from Nvim core as providers: - -The first example is clipboard integration: in the original Vim source code, -clipboard functions account for more than 1k lines of C source code (and that -is just on ui.c), all to perform two tasks that are now accomplished with -simple shell commands such as xclip or pbcopy/pbpaste. - -The other example is Python scripting support: Vim has three files dedicated to -embedding the Python interpreter: if_python.c, if_python3.c and if_py_both.h. -Together these files sum about 9.5k lines of C source code. On Nvim, Python -scripting is performed by an external host process that is running 2k sloc -Python program. - -In a perfect world, we would implement Python and clipboard integration in -pure vimscript and without touching the C code. Unfortunately we can't achieve -these goals without severely compromising backwards compatibility with Vim. -That's where providers come to the rescue. - -In essence, this infrastructure is a simple framework that simplifies the task -of calling vimscript from C code, making it simpler to rewrite C functions that -interact with external systems in pure vimscript. It is composed of two -functions in eval.c: - -- eval_call_provider(name, method, arguments): Call a provider(name) method - with arguments -- eval_has_provider(name): Checks if a provider is implemented - -What these functions do is simple: - -- eval_call_provider will call the provider#(name)#Call function passing in - the method and arguments. -- eval_has_provider will return true if the provider#(name)#Call function is - implemented, and is called by the "has" vimscript function to check if - features are available. - -The basic idea is that the provider#(name)#Call function should implement -integration with an external system, because calling shell commands and -|msgpack-rpc| clients (Nvim only) is easier to do in vimscript. - -Now, back to the Python example. Instead of modifying vimscript to allow for -the definition of lowercase functions and commands (for the |:python|, -|:pyfile|, and |:pydo| commands, and the |pyeval()| function), which would -break backwards compatibility with Vim, we implemented the -autoload/provider/python.vim script and the provider#python#Call function -that is only defined if an external Python host is started successfully. - -That works well with the `has('python')` expression (normally used by Python -plugins) because if the Python host isn't installed then the plugin will -"think" it is running in a Vim compiled without |+python| feature. - -============================================================================== - vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/nvim_python.txt b/runtime/doc/nvim_python.txt deleted file mode 100644 index a2fc968db4..0000000000 --- a/runtime/doc/nvim_python.txt +++ /dev/null @@ -1,95 +0,0 @@ -*nvim_python.txt* For Nvim. {Nvim} - - - NVIM REFERENCE MANUAL by Thiago de Arruda - - -Python plugins and scripting in Nvim *nvim-python* - -1. Introduction |nvim-python-intro| -2. Quickstart |nvim-python-quickstart| - -============================================================================== -1. Introduction *nvim-python-intro* - -Through external Python 2/3 interpreters connected via |msgpack-rpc|, Nvim -offers some support for the legacy |python-vim| and |python3| interfaces. - -Note: For now only the old Vim 7.3 API is supported. - -============================================================================== -2. Quickstart *nvim-python-quickstart* - -If you used a package manager to install Nvim, there's a good chance that -it also provides the `neovim` Python package. If it doesn't, follow these -steps to install the package with Python's package manager, `pip`. - -Note: Depending on your system, `pip` might refer to Python 2 or Python 3, - which is why the following instructions mention `pip2` or `pip3` - explicitly. If one of these is not available for you, maybe `pip` - is what you want. - -To use Vim Python 2/3 plugins with Nvim, do the following: - -- For Python 2 plugins, make sure an interpreter for Python 2.6 or 2.7 is - available in your `$PATH`, then install the `neovim` Python package systemwide: - > - $ sudo pip2 install neovim -< - or for the current user: -> - $ pip2 install --user neovim -< -- For Python 3 plugins, make sure an interpreter for Python 3.3 or above is - available in your `$PATH`, then install the `neovim` Python package systemwide: - > - $ sudo pip3 install neovim -< - or for the current user: -> - $ pip3 install --user neovim -< -Note: If you previously installed the package, get the latest version by - appending the `--upgrade` flag to the commands above. - -============================================================================== - *g:python_host_prog* - -To point Nvim to a specific Python 2 interpreter, set |g:python_host_prog|: -> - let g:python_host_prog = '/path/to/python' -< - *g:python3_host_prog* - -To point Nvim to a specific Python 3 interpreter, set |g:python3_host_prog|: -> - let g:python3_host_prog = '/path/to/python3' -< - *g:loaded_python_provider* - -To disable Python 2 interface, set `g:loaded_python_provider` to 1: -> - let g:loaded_python_provider = 1 -< - *g:loaded_python3_provider* - -To disable Python 3 interface, set `g:loaded_python3_provider` to 1: -> - let g:loaded_python3_provider = 1 -< - *g:python_host_skip_check* - -To disable Python 2 interpreter check, set `g:python_host_skip_check` to 1: -Note: If you disable Python 2 check, you must install neovim module properly. -> - let g:python_host_skip_check = 1 -< - *g:python3_host_skip_check* - -To disable Python 3 interpreter check, set `g:python3_host_skip_check` to 1: -Note: If you disable Python 3 check, you must install neovim module properly. -> - let g:python3_host_skip_check = 1 -< -============================================================================== - vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 6ef3aaebaa..8f7dc0dbf0 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -1,34 +1,31 @@ -*nvim_terminal_emulator.txt* For Nvim. {Nvim} +*terminal_emulator.txt* {Nvim} NVIM REFERENCE MANUAL by Thiago de Arruda -Nvim integrated terminal emulator *nvim-terminal-emulator* +Embedded terminal emulator *terminal-emulator* -1. Introduction |nvim-terminal-emulator-introduction| -2. Spawning |nvim-terminal-emulator-spawning| -3. Input |nvim-terminal-emulator-input| -4. Configuration |nvim-terminal-emulator-configuration| +1. Introduction |terminal-emulator-intro| +2. Spawning |terminal-emulator-spawning| +3. Input |terminal-emulator-input| +4. Configuration |terminal-emulator-configuration| +5. Status Variables |terminal-emulator-status| ============================================================================== -1. Introduction *nvim-terminal-emulator-introduction* +1. Introduction *terminal-emulator-intro* -One feature that distinguishes Nvim from Vim is that it implements a mostly -complete VT220/xterm-like terminal emulator. The terminal is presented to the -user as a special buffer type, one that is asynchronously updated to mirror -the virtual terminal display as data is received from the program connected -to it. For most purposes, terminal buffers behave a lot like normal buffers -with 'nomodifiable' set. +Nvim offers a mostly complete VT220/xterm terminal emulator. The terminal is +presented as a special buffer type, asynchronously updated to mirror the +virtual terminal display as data is received from the program connected to it. +For most purposes, terminal buffers behave a lot like normal buffers with +'nomodifiable' set. - -The implementation is powered by libvterm[1], a powerful abstract terminal -emulation library. - -[1]: http://www.leonerd.org.uk/code/libvterm/ +The implementation is powered by libvterm, a powerful abstract terminal +emulation library. http://www.leonerd.org.uk/code/libvterm/ ============================================================================== -2. Spawning *nvim-terminal-emulator-spawning* +2. Spawning *terminal-emulator-spawning* There are 3 ways to create a terminal buffer: @@ -37,16 +34,22 @@ There are 3 ways to create a terminal buffer: - By editing a file with a name matching `term://(.{-}//(\d+:)?)?\zs.*`. For example: > - :e term://bash - :vsp term://top + :edit term://bash + :vsplit term://top < + Note: The "term://" pattern is handled by a BufReadCmd handler, so the + |autocmd-nested| modifier is required to use it in an autocmd. > + autocmd VimEnter * nested split term://sh +< This is only mentioned for reference; you should use the |:terminal| + command instead. + When the terminal spawns the program, the buffer will start to mirror the terminal display and change its name to `term://$CWD//$PID:$COMMAND`. Note that |:mksession| will "save" the terminal buffers by restarting all programs when the session is restored. ============================================================================== -3. Input *nvim-terminal-emulator-input* +3. Input *terminal-emulator-input* Sending input is possible by entering terminal mode, which is achieved by pressing any key that would enter insert mode in a normal buffer (|i| or |a| @@ -90,7 +93,7 @@ Mouse input is also fully supported, and has the following behavior: the terminal wont lose focus and the hovered window will be scrolled. ============================================================================== -4. Configuration *nvim-terminal-emulator-configuration* +4. Configuration *terminal-emulator-configuration* Terminal buffers can be customized through the following global/buffer-local variables (set via the |TermOpen| autocmd): @@ -111,4 +114,25 @@ The terminal cursor can be highlighted via |hl-TermCursor| and |hl-TermCursorNC|. ============================================================================== +5. Status Variables *terminal-emulator-status* + +Terminal buffers maintain some information about the terminal in buffer-local +variables: + +- *b:term_title* The settable title of the terminal, typically displayed in + the window title or tab title of a graphical terminal emulator. Programs + running in the terminal can set this title via an escape sequence. +- *b:terminal_job_id* The nvim job ID of the job running in the terminal. See + |job-control| for more information. +- *b:terminal_job_pid* The PID of the top-level process running in the + terminal. + +These variables will have a value by the time the TermOpen autocmd runs, and +will continue to have a value for the lifetime of the terminal buffer, making +them suitable for use in 'statusline'. For example, to show the terminal title +as the status line: +> + :autocmd TermOpen * setlocal statusline=%{b:term_title} +< +============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 83ae96a651..97d56af369 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2016 Jan 03 +*options.txt* For Vim version 7.4. Last change: 2016 Jul 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -52,7 +52,6 @@ achieve special effects. These options come in three forms: :se[t] all& Set all options to their default value. The values of these options are not changed: 'columns' - 'encoding' 'lines' Warning: This may have a lot of side effects. @@ -247,10 +246,10 @@ global value, which is used for new buffers. With ":set" both the local and global value is changed. With "setlocal" only the local value is changed, thus this value is not used when editing a new buffer. -When editing a buffer that has been edited before, the last used window -options are used again. If this buffer has been edited in this window, the -values from back then are used. Otherwise the values from the window where -the buffer was edited last are used. +When editing a buffer that has been edited before, the options from the window +that was last closed are used again. If this buffer has been edited in this +window, the values from back then are used. Otherwise the values from the +last closed window where the buffer was edited last are used. It's possible to set a local window option specifically for a type of buffer. When you edit another buffer in the same window, you don't want to keep @@ -497,6 +496,7 @@ For example, to use a modeline only for Vim 7.0: To use a modeline for Vim after version 7.2: /* vim>702: set cole=2: */ ~ There can be no blanks between "vim" and the ":". +The modeline is ignored if {vers} does not fit in an integer. {Nvim} The number of lines that are checked can be set with the 'modelines' option. @@ -614,7 +614,6 @@ A jump table for the options with a short description can be found at |Q_op|. global {only available when compiled with the |+multi_byte| feature} - Only effective when 'encoding' is "utf-8" or another Unicode encoding. Tells Vim what to do with characters with East Asian Width Class Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek letters, Cyrillic letters). @@ -667,7 +666,6 @@ A jump table for the options with a short description can be found at |Q_op|. - Set the 'keymap' option to "arabic"; in Insert mode CTRL-^ toggles between typing English and Arabic key mapping. - Set the 'delcombine' option - Note that 'encoding' must be "utf-8" for working with Arabic text. Resetting this option will: - Reset the 'rightleft' option. @@ -899,7 +897,7 @@ A jump table for the options with a short description can be found at |Q_op|. - The backup file will be created in the first directory in the list where this is possible. The directory must exist, Vim will not create it for you. - - Empty means that no backup file will be created ( 'patchmode' is + - Empty means that no backup file will be created ('patchmode' is impossible!). Writing may fail because of this. - A directory "." means to put the backup file in the same directory as the edited file. @@ -1077,8 +1075,7 @@ A jump table for the options with a short description can be found at |Q_op|. {not available when compiled without the |+linebreak| feature} This option lets you choose which characters might cause a line - break if 'linebreak' is on. Only works for ASCII and also for 8-bit - characters when 'encoding' is an 8-bit encoding. + break if 'linebreak' is on. Only works for ASCII characters. *'breakindent'* *'bri'* 'breakindent' 'bri' boolean (default off) @@ -1158,22 +1155,14 @@ A jump table for the options with a short description can be found at |Q_op|. *'buftype'* *'bt'* *E382* 'buftype' 'bt' string (default: "") local to buffer - {not available when compiled without the |+quickfix| - feature} The value of this option specifies the type of a buffer: <empty> normal buffer - nofile buffer which is not related to a file and will not be - written - nowrite buffer which will not be written - acwrite buffer which will always be written with BufWriteCmd - autocommands. - quickfix quickfix buffer, contains list of errors |:cwindow| - or list of locations |:lwindow| - help help buffer (you are not supposed to set this - manually) - terminal terminal buffer, this is set automatically when a - terminal is created. See |nvim-terminal-emulator| for - more information. + acwrite buffer will always be written with |BufWriteCmd|s + help help buffer (do not set this manually) + nofile buffer is not related to a file, will not be written + nowrite buffer will not be written + quickfix list of errors |:cwindow| or locations |:lwindow| + terminal |terminal-emulator| buffer This option is used together with 'bufhidden' and 'swapfile' to specify special kinds of buffers. See |special-buffers|. @@ -1214,11 +1203,9 @@ A jump table for the options with a short description can be found at |Q_op|. Specifies details about changing the case of letters. It may contain these words, separated by a comma: internal Use internal case mapping functions, the current - locale does not change the case mapping. This only - matters when 'encoding' is a Unicode encoding, - "latin1" or "iso-8859-15". When "internal" is - omitted, the towupper() and towlower() system library - functions are used when available. + locale does not change the case mapping. When + "internal" is omitted, the towupper() and towlower() + system library functions are used when available. keepascii For the ASCII characters (0x00 to 0x7f) use the US case mapping, the current locale is not effective. This probably only matters for Turkish. @@ -1251,8 +1238,8 @@ A jump table for the options with a short description can be found at |Q_op|. Only non-printable keys are allowed. The key can be specified as a single character, but it is difficult to type. The preferred way is to use the <> notation. Examples: > - :set cedit=<C-Y> - :set cedit=<Esc> + :exe "set cedit=\<C-Y>" + :exe "set cedit=\<Esc>" < |Nvi| also has this option, but it only uses the first character. See |cmdwin|. @@ -1271,13 +1258,12 @@ A jump table for the options with a short description can be found at |Q_op|. file to convert from. You will have to save the text in a file first. The expression must return zero or an empty string for success, non-zero for failure. - The possible encoding names encountered are in 'encoding'. + See |encoding-names| for possible encoding names. Additionally, names given in 'fileencodings' and 'fileencoding' are used. Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8" is done internally by Vim, 'charconvert' is not used for this. - 'charconvert' is also used to convert the shada file, if 'encoding' is - not "utf-8". Also used for Unicode conversion. + Also used for Unicode conversion. Example: > set charconvert=CharConvert() fun CharConvert() @@ -1292,8 +1278,6 @@ A jump table for the options with a short description can be found at |Q_op|. v:fname_in name of the input file v:fname_out name of the output file Note that v:fname_in and v:fname_out will never be the same. - Note that v:charconvert_from and v:charconvert_to may be different - from 'encoding'. Vim internally uses UTF-8 instead of UCS-2 or UCS-4. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -1353,7 +1337,7 @@ A jump table for the options with a short description can be found at |Q_op|. used regardless of whether "unnamed" is in 'clipboard' or not. The clipboard register can always be explicitly accessed using the "* notation. Also see - |gui-clipboard|. + |clipboard|. *clipboard-unnamedplus* unnamedplus A variant of the "unnamed" flag which uses the @@ -1363,7 +1347,7 @@ A jump table for the options with a short description can be found at |Q_op|. register. When "unnamed" is also included to the option, yank and delete operations (but not put) will additionally copy the text into register - '*'. See |nvim-clipboard|. + '*'. See |clipboard|. *clipboard-autoselect* autoselect Works like the 'a' flag in 'guioptions': If present, @@ -1450,9 +1434,6 @@ A jump table for the options with a short description can be found at |Q_op|. comment text. Currently only used to add markers for folding, see |fold-marker|. - *'compatible'* *'cp'* *'nocompatible'* *'nocp'* -'compatible' 'cp' Removed. |vim-differences| {Nvim} - *'complete'* *'cpt'* *E535* 'complete' 'cpt' string (default: ".,w,b,u,t") local to buffer @@ -1460,7 +1441,7 @@ A jump table for the options with a short description can be found at |Q_op|. when CTRL-P or CTRL-N are used. It is also used for whole-line completion |i_CTRL-X_CTRL-L|. It indicates the type of completion and the places to scan. It is a comma separated list of flags: - . scan the current buffer ( 'wrapscan' is ignored) + . scan the current buffer ('wrapscan' is ignored) w scan buffers from other windows b scan other loaded buffers that are in the buffer list u scan the unloaded buffers that are in the buffer list @@ -1602,7 +1583,7 @@ A jump table for the options with a short description can be found at |Q_op|. line, the remaining space is filled in the normal manner. See 'preserveindent'. - *'cpoptions'* *'cpo'* + *'cpoptions'* *'cpo'* *cpo* 'cpoptions' 'cpo' string (Vim default: "aABceFs", Vi default: all flags) global @@ -1849,9 +1830,6 @@ A jump table for the options with a short description can be found at |Q_op|. the cursor would skip over it and jump to the following occurrence. - *'cryptmethod'* *'cm'* -'cryptmethod' Removed. |vim-differences| {Nvim} - *'cscopepathcomp'* *'cspc'* 'cscopepathcomp' 'cspc' number (default 0) global @@ -2117,11 +2095,17 @@ A jump table for the options with a short description can be found at |Q_op|. Change the way text is displayed. This is comma separated list of flags: lastline When included, as much as possible of the last line - in a window will be displayed. When not included, a - last line that doesn't fit is replaced with "@" lines. + in a window will be displayed. "@@@" is put in the + last columns of the last screen line to indicate the + rest of the line is not displayed. + truncate Like "lastline", but "@@@" is displayed in the first + column of the last screen line. Overrules "lastline". uhex Show unprintable characters hexadecimal as <xx> instead of using ^C and ~C. + When neither "lastline" or "truncate" is included, a last line that + doesn't fit is replaced with "@" lines. + *'eadirection'* *'ead'* 'eadirection' 'ead' string (default "both") global @@ -2130,48 +2114,24 @@ A jump table for the options with a short description can be found at |Q_op|. hor horizontally, height of windows is not affected both width and height of windows is affected - *'ed'* *'edcompatible'* *'noed'* *'noedcompatible'* -'edcompatible' 'ed' Removed. |vim-differences| {Nvim} - - *'encoding'* *'enc'* *E543* -'encoding' 'enc' string (default: "utf-8") + *'emoji'* *'emo'* +'emoji' 'emo' boolean (default: on) global + {not in Vi} {only available when compiled with the |+multi_byte| feature} - Sets the character encoding used inside Vim. It applies to text in - the buffers, registers, Strings in expressions, text stored in the - shada file, etc. It sets the kind of characters which Vim can work - with. See |encoding-names| for the possible values. + When on all Unicode emoji characters are considered to be full width. - 'encoding' cannot be changed after startup, because (1) it causes - non-ASCII text inside Vim to become invalid, and (2) it complicates - runtime logic. The recommended 'encoding' is "utf-8". Remote plugins - and GUIs only support utf-8. See |multibyte|. - The character encoding of files can be different from 'encoding'. + *'encoding'* *'enc'* *E543* +'encoding' 'enc' Removed. |vim-differences| {Nvim} + Nvim always uses UTF-8 internally. RPC communication + (remote plugins/GUIs) must use UTF-8 strings. + + The character encoding of files can be different than UTF-8. This is specified with 'fileencoding'. The conversion is done with iconv() or as specified with 'charconvert'. - If you need to know whether 'encoding' is a multi-byte encoding, you - can use: > - if has("multi_byte_encoding") -< - When you set this option, it fires the |EncodingChanged| autocommand - event so that you can set up fonts if necessary. - - When the option is set, the value is converted to lowercase. Thus - you can set it with uppercase values too. Underscores are translated - to '-' signs. - When the encoding is recognized, it is changed to the standard name. - For example "Latin-1" becomes "latin1", "ISO_88592" becomes - "iso-8859-2" and "utf8" becomes "utf-8". - - When "unicode", "ucs-2" or "ucs-4" is used, Vim internally uses utf-8. - You don't notice this while editing, but it does matter for the - |shada-file|. And Vim expects the terminal to use utf-8 too. Thus - setting 'encoding' to one of these values instead of utf-8 only has - effect for encoding used for files when 'fileencoding' is empty. - *'endofline'* *'eol'* *'noendofline'* *'noeol'* 'endofline' 'eol' boolean (default on) local to buffer @@ -2298,20 +2258,14 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Sets the character encoding for the file of this buffer. - When 'fileencoding' is different from 'encoding', conversion will be + When 'fileencoding' is different from "utf-8", conversion will be done when writing the file. For reading see below. - When 'fileencoding' is empty, the same value as 'encoding' will be - used (no conversion when reading or writing a file). - Conversion will also be done when 'encoding' and 'fileencoding' are - both a Unicode encoding and 'fileencoding' is not utf-8. That's - because internally Unicode is always stored as utf-8. - WARNING: Conversion can cause loss of information! When - 'encoding' is "utf-8" or another Unicode encoding, conversion - is most likely done in a way that the reverse conversion - results in the same text. When 'encoding' is not "utf-8" some - characters may be lost! - - See 'encoding' for the possible values. Additionally, values may be + When 'fileencoding' is empty, the file will be saved with utf-8 + encoding. (no conversion when reading or writing a file). + WARNING: Conversion to a non-Unicode encoding can cause loss of + information! + + See |encoding-names| for the possible values. Additionally, values may be specified that can be handled by the converter, see |mbyte-conversion|. @@ -2324,8 +2278,8 @@ A jump table for the options with a short description can be found at |Q_op|. Prepending "8bit-" and "2byte-" has no meaning here, they are ignored. When the option is set, the value is converted to lowercase. Thus you can set it with uppercase values too. '_' characters are - replaced with '-'. If a name is recognized from the list for - 'encoding', it is replaced by the standard name. For example + replaced with '-'. If a name is recognized from the list at + |encoding-names|, it is replaced by the standard name. For example "ISO8859-2" becomes "iso-8859-2". When this option is set, after starting to edit a file, the 'modified' @@ -2338,11 +2292,6 @@ A jump table for the options with a short description can be found at |Q_op|. This option can not be changed when 'modifiable' is off. - *'fe'* - NOTE: Before version 6.0 this option specified the encoding for the - whole of Vim, this was a mistake. Now use 'encoding' instead. The - old short name was 'fe', which is no longer used. - *'fileencodings'* *'fencs'* 'fileencodings' 'fencs' string (default: "ucs-bom,utf-8,default,latin1") global @@ -2353,12 +2302,8 @@ A jump table for the options with a short description can be found at |Q_op|. mentioned character encoding. If an error is detected, the next one in the list is tried. When an encoding is found that works, 'fileencoding' is set to it. If all fail, 'fileencoding' is set to - an empty string, which means the value of 'encoding' is used. - WARNING: Conversion can cause loss of information! When - 'encoding' is "utf-8" (or one of the other Unicode variants) - conversion is most likely done in a way that the reverse - conversion results in the same text. When 'encoding' is not - "utf-8" some non-ASCII characters may be lost! You can use + an empty string, which means that UTF-8 is used. + WARNING: Conversion can cause loss of information! You can use the |++bad| argument to specify what is done with characters that can't be converted. For an empty file or a file with only ASCII characters most encodings @@ -2384,11 +2329,11 @@ A jump table for the options with a short description can be found at |Q_op|. because Vim cannot detect an error, thus the encoding is always accepted. The special value "default" can be used for the encoding from the - environment. It is useful when 'encoding' is set to "utf-8" and - your environment uses a non-latin1 encoding, such as Russian. - When 'encoding' is "utf-8" and a file contains an illegal byte - sequence it won't be recognized as UTF-8. You can use the |8g8| - command to find the illegal byte sequence. + environment. It is useful when your environment uses a non-latin1 + encoding, such as Russian. + When a file contains an illegal UTF-8 byte sequence it won't be + recognized as "utf-8". You can use the |8g8| command to find the + illegal byte sequence. WRONG VALUES: WHAT'S WRONG: latin1,utf-8 "latin1" will always be used utf-8,ucs-bom,latin1 BOM won't be recognized in an utf-8 @@ -2459,8 +2404,8 @@ A jump table for the options with a short description can be found at |Q_op|. file only, the option is not changed. When 'binary' is set, the value of 'fileformats' is not used. - Note that when Vim starts up with an empty buffer this option is not - used. Set 'fileformat' in your vimrc instead. + When Vim starts up with an empty buffer the first item is used. You + can overrule this by setting 'fileformat' in your .vimrc. For systems with a Dos-like <EOL> (<CR><NL>), when reading files that are ":source"ed and for vimrc files, automatic <EOL> detection may be @@ -2515,17 +2460,17 @@ A jump table for the options with a short description can be found at |Q_op|. item default Used for ~ stl:c ' ' or '^' statusline of the current window - stlnc:c ' ' or '-' statusline of the non-current windows + stlnc:c ' ' or '=' statusline of the non-current windows vert:c '|' vertical separators |:vsplit| fold:c '-' filling 'foldtext' diff:c '-' deleted lines of the 'diff' option Any one that is omitted will fall back to the default. For "stl" and - "stlnc" the space will be used when there is highlighting, '^' or '-' + "stlnc" the space will be used when there is highlighting, '^' or '=' otherwise. Example: > - :set fillchars=stl:^,stlnc:-,vert:\|,fold:-,diff:- + :set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:- < This is similar to the default, except that these characters will also be used when there is highlighting. @@ -2737,6 +2682,40 @@ A jump table for the options with a short description can be found at |Q_op|. It is not allowed to change text or jump to another window while evaluating 'foldtext' |textlock|. + *'formatexpr'* *'fex'* +'formatexpr' 'fex' string (default "") + local to buffer + {not available when compiled without the |+eval| + feature} + Expression which is evaluated to format a range of lines for the |gq| + operator or automatic formatting (see 'formatoptions'). When this + option is empty 'formatprg' is used. + + The |v:lnum| variable holds the first line to be formatted. + The |v:count| variable holds the number of lines to be formatted. + The |v:char| variable holds the character that is going to be + inserted if the expression is being evaluated due to + automatic formatting. This can be empty. Don't insert + it yet! + + Example: > + :set formatexpr=mylang#Format() +< This will invoke the mylang#Format() function in the + autoload/mylang.vim file in 'runtimepath'. |autoload| + + The expression is also evaluated when 'textwidth' is set and adding + text beyond that limit. This happens under the same conditions as + when internal formatting is used. Make sure the cursor is kept in the + same spot relative to the text then! The |mode()| function will + return "i" or "R" in this situation. + + When the expression evaluates to non-zero Vim will fall back to using + the internal format mechanism. + + The expression will be evaluated in the |sandbox| when set from a + modeline, see |sandbox-option|. That stops the option from working, + since changing the buffer text is not allowed. + *'formatoptions'* *'fo'* 'formatoptions' 'fo' string (default: "tcqj", Vi default: "vt") local to buffer @@ -2775,40 +2754,6 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - *'formatexpr'* *'fex'* -'formatexpr' 'fex' string (default "") - local to buffer - {not available when compiled without the |+eval| - feature} - Expression which is evaluated to format a range of lines for the |gq| - operator or automatic formatting (see 'formatoptions'). When this - option is empty 'formatprg' is used. - - The |v:lnum| variable holds the first line to be formatted. - The |v:count| variable holds the number of lines to be formatted. - The |v:char| variable holds the character that is going to be - inserted if the expression is being evaluated due to - automatic formatting. This can be empty. Don't insert - it yet! - - Example: > - :set formatexpr=mylang#Format() -< This will invoke the mylang#Format() function in the - autoload/mylang.vim file in 'runtimepath'. |autoload| - - The expression is also evaluated when 'textwidth' is set and adding - text beyond that limit. This happens under the same conditions as - when internal formatting is used. Make sure the cursor is kept in the - same spot relative to the text then! The |mode()| function will - return "i" or "R" in this situation. - - When the expression evaluates to non-zero Vim will fall back to using - the internal format mechanism. - - The expression will be evaluated in the |sandbox| when set from a - modeline, see |sandbox-option|. That stops the option from working, - since changing the buffer text is not allowed. - *'fsync'* *'fs'* 'fsync' 'fs' boolean (default on) global @@ -3047,8 +2992,7 @@ A jump table for the options with a short description can be found at |Q_op|. Note: The size of these fonts must be exactly twice as wide as the one specified with 'guifont' and the same height. - 'guifontwide' is only used when 'encoding' is set to "utf-8" and - 'guifontset' is empty or invalid. + 'guifontwide' is only used when 'guifontset' is empty or invalid. When 'guifont' is set and a valid font is found in it and 'guifontwide' is empty Vim will attempt to find a matching double-width font and set 'guifontwide' to it. @@ -3097,7 +3041,7 @@ A jump table for the options with a short description can be found at |Q_op|. The same applies to the modeless selection. *'go-P'* 'P' Like autoselect but using the "+ register instead of the "* - register. + register. *'go-A'* 'A' Autoselect for the modeless selection. Like 'a', but only applies to the modeless selection. @@ -3165,9 +3109,6 @@ A jump table for the options with a short description can be found at |Q_op|. removing it after the GUI has started has no effect. - *'guipty'* *'noguipty'* -'guipty' Removed. |vim-differences| {Nvim} - *'guitablabel'* *'gtl'* 'guitablabel' 'gtl' string (default empty) global @@ -3328,8 +3269,6 @@ A jump table for the options with a short description can be found at |Q_op|. - no highlighting : use a highlight group The default is used for occasions that are not included. - If you want to change what the display modes do, see |dos-colors| - for an example. When using the ':' display mode, this must be followed by the name of a highlight group. A highlight group can be used to define any type of highlighting, including using color. See |:highlight| on how to @@ -3414,12 +3353,6 @@ A jump table for the options with a short description can be found at |Q_op|. Can be overruled by using "\c" or "\C" in the pattern, see |/ignorecase|. - *'imactivatefunc'* *'imaf'* -'imactivatefunc' 'imaf' Removed. |vim-differences| {Nvim} - - *'imactivatekey'* *'imak'* -'imactivatekey' 'imak' Removed. |vim-differences| {Nvim} - *'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'* 'imcmdline' 'imc' boolean (default off) global @@ -3476,8 +3409,17 @@ A jump table for the options with a short description can be found at |Q_op|. The value is set to 1 when it is not -1 and setting the 'keymap' option to a valid keymap name. - *'imstatusfunc'* *'imsf'* -'imstatusfunc' 'imsf' Removed. |vim-differences| {Nvim} + *'inccommand'* *'icm'* +'inccommand' 'icm' string (default "") + global + + "nosplit": Shows the effects of a command incrementally, as you type. + "split" : Also shows partial off-screen results in a preview window. + + Works for |:substitute|, |:smagic|, |:snomagic|. |hl-Substitute| + + If the preview is too slow (exceeds 'redrawtime') then 'inccommand' is + automatically disabled until |Command-line-mode| is done. *'include'* *'inc'* 'include' 'inc' string (default "^\s*#\s*include") @@ -3696,6 +3638,8 @@ A jump table for the options with a short description can be found at |Q_op|. '*', '"' and '|' (so that CTRL-] on a command finds the help for that command). When the 'lisp' option is on the '-' character is always included. + This option also influences syntax highlighting, unless the syntax + uses |:syn-iskeyword|. *'isprint'* *'isp'* 'isprint' 'isp' string (default: "@,161-255") @@ -3713,7 +3657,7 @@ A jump table for the options with a short description can be found at |Q_op|. 128 - 159 "~@" - "~_" 160 - 254 "| " - "|~" 255 "~?" - When 'encoding' is a Unicode one, illegal bytes from 128 to 255 are + Illegal bytes from 128 to 255 (invalid UTF-8) are displayed as <xx>, with the hexadecimal value of the byte. When 'display' contains "uhex" all unprintable characters are displayed as <xx>. @@ -3733,9 +3677,6 @@ A jump table for the options with a short description can be found at |Q_op|. Insert two spaces after a '.', '?' and '!' with a join command. Otherwise only one space is inserted. - *'key'* -'key' Removed. |vim-differences| {Nvim} - *'keymap'* *'kmp'* *E544* 'keymap' 'kmp' string (default "") local to buffer @@ -3960,6 +3901,7 @@ A jump table for the options with a short description can be found at |Q_op|. global Strings to use in 'list' mode and for the |:list| command. It is a comma separated list of string settings. + *lcs-eol* eol:c Character to show at the end of each line. When omitted, there is no extra character at the end of the @@ -3994,8 +3936,7 @@ A jump table for the options with a short description can be found at |Q_op|. omitted. The characters ':' and ',' should not be used. UTF-8 characters can - be used when 'encoding' is "utf-8", otherwise only printable - characters are allowed. All characters must be single width. + be used. All characters must be single width. Examples: > :set lcs=tab:>-,trail:- @@ -4014,9 +3955,6 @@ A jump table for the options with a short description can be found at |Q_op|. Note that using the "-u NONE" and "--noplugin" command line arguments reset this option. |-u| |--noplugin| - *'macatsui'* *'nomacatsui'* -'macatsui' Removed. |vim-differences| {Nvim} - *'magic'* *'nomagic'* 'magic' boolean (default on) global @@ -4095,7 +4033,6 @@ A jump table for the options with a short description can be found at |Q_op|. {only available when compiled with the |+multi_byte| feature} The maximum number of combining characters supported for displaying. - Only used when 'encoding' is "utf-8". The default is OK for most languages. Hebrew may require 4. Maximum value is 6. Even when this option is set to 2 you can still edit text with more @@ -4239,6 +4176,7 @@ A jump table for the options with a short description can be found at |Q_op|. written. A ":set nomodified" command also resets the original values to the current values and the 'modified' option will be reset. + Similarly for 'eol' and 'bomb'. This option is not set when a change is made to the buffer as the result of a BufNewFile, BufRead/BufReadPost, BufWritePost, FileAppendPost or VimLeave autocommand event. See |gzip-example| for @@ -4399,9 +4337,8 @@ A jump table for the options with a short description can be found at |Q_op|. *'mousetime'* *'mouset'* 'mousetime' 'mouset' number (default 500) global - Only for GUI, Windows and Unix with xterm. Defines the maximum - time in msec between two mouse clicks for the second click to be - recognized as a multi click. + Defines the maximum time in msec between two mouse clicks for the + second click to be recognized as a multi click. *'nrformats'* *'nf'* 'nrformats' 'nf' string (default "bin,hex") @@ -4411,7 +4348,7 @@ A jump table for the options with a short description can be found at |Q_op|. respectively; see |CTRL-A| for more info on these commands. alpha If included, single alphabetical characters will be incremented or decremented. This is useful for a list with a - letter index a), b), etc. *octal-nrformats* + letter index a), b), etc. *octal-nrformats* octal If included, numbers that start with a zero will be considered to be octal. Example: Using CTRL-A on "007" results in "010". hex If included, numbers starting with "0x" or "0X" will be @@ -4441,7 +4378,7 @@ A jump table for the options with a short description can be found at |Q_op|. relative to the cursor. Together with 'number' there are these four combinations (cursor in line 3): - 'nonu' 'nu' 'nonu' 'nu' + 'nonu' 'nu' 'nonu' 'nu' 'nornu' 'nornu' 'rnu' 'rnu' |apple | 1 apple | 2 apple | 2 apple @@ -4500,6 +4437,12 @@ A jump table for the options with a short description can be found at |Q_op|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. + *'packpath'* *'pp'* +'packpath' 'pp' string (default: see 'runtimepath') + {not in Vi} + Directories used to find packages. See |packages|. + + *'paragraphs'* *'para'* 'paragraphs' 'para' string (default "IPLPPPQPP TPHPLIPpLpItpplpipbp") global @@ -4793,8 +4736,8 @@ A jump table for the options with a short description can be found at |Q_op|. global {only available when compiled with the |+reltime| feature} - The time in milliseconds for redrawing the display. This applies to - searching for patterns for 'hlsearch' and |:match| highlighting. + Time in milliseconds for redrawing the display. Applies to + 'hlsearch', 'inccommand' and |:match| highlighting. When redrawing takes more than this many milliseconds no further matches will be highlighted. This is used to avoid that Vim hangs when using a very complicated pattern. @@ -4854,9 +4797,6 @@ A jump table for the options with a short description can be found at |Q_op|. For the ":substitute" command the number of substitutions is used instead of the number of lines. - *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'* -'restorescreen' 'rs' Removed. |vim-differences| {Nvim} - *'revins'* *'ri'* *'norevins'* *'nori'* 'revins' 'ri' boolean (default off) global @@ -4937,7 +4877,7 @@ A jump table for the options with a short description can be found at |Q_op|. $XDG_CONFIG_DIRS[1]/nvim, $XDG_CONFIG_DIRS[2]/nvim, … - $XDG_DATA_HOME/nvim, + $XDG_DATA_HOME/nvim/site, $XDG_DATA_DIRS[1]/nvim/site, $XDG_DATA_DIRS[2]/nvim/site, … @@ -4945,7 +4885,7 @@ A jump table for the options with a short description can be found at |Q_op|. … $XDG_DATA_DIRS[2]/nvim/site/after, $XDG_DATA_DIRS[1]/nvim/site/after, - $XDG_DATA_HOME/nvim/after, + $XDG_DATA_HOME/nvim/site/after, … $XDG_CONFIG_DIRS[2]/nvim/after, $XDG_CONFIG_DIRS[1]/nvim/after, @@ -4964,6 +4904,7 @@ A jump table for the options with a short description can be found at |Q_op|. keymap/ key mapping files |mbyte-keymap| lang/ menu translations |:menutrans| menu.vim GUI menus |menu.vim| + pack/ packages |:packadd| plugin/ plugin scripts |write-plugin| print/ files for printing |postscript-print-encoding| spell/ spell checking files |spell| @@ -4990,6 +4931,8 @@ A jump table for the options with a short description can be found at |Q_op|. ordering. This is for preferences to overrule or add to the distributed defaults or system-wide settings (rarely needed). + More entries are added when using |packages|. + Note that, unlike 'path', no wildcards like "**" are allowed. Normal wildcards are allowed, but can significantly slow down searching for runtime files. For speed, use as few items as possible and avoid @@ -5257,10 +5200,10 @@ A jump table for the options with a short description can be found at |Q_op|. has been used since the last search command. *shada-n* n Name of the shada file. The name must immediately follow - the 'n'. Must be the last one! If the "-i" argument was - given when starting Vim, that file name overrides the one - given here with 'shada'. Environment variables are expanded - when opening the file, not when setting the option. + the 'n'. Must be at the end of the option! If the "-i" + argument was given when starting Vim, that file name overrides + the one given here with 'shada'. Environment variables are + expanded when opening the file, not when setting the option. *shada-r* r Removable media. The argument is a string (up to the next ','). This parameter can be given several times. Each @@ -5466,6 +5409,7 @@ A jump table for the options with a short description can be found at |Q_op|. The |FilterReadPre|, |FilterReadPost| and |FilterWritePre|, |FilterWritePost| autocommands event are not triggered when 'shelltemp' is off. + |system()| does not respect this option, it always uses pipes. *'shellxescape'* *'sxe'* 'shellxescape' 'sxe' string (default: ""; @@ -5564,9 +5508,6 @@ A jump table for the options with a short description can be found at |Q_op|. shm=a Abbreviation, but no loss of information. shm=at Abbreviation, and truncate message when necessary. - *'shortname'* *'sn'* *'noshortname'* *'nosn'* -'shortname' 'sn' Removed. |vim-differences| {Nvim} - *'showbreak'* *'sbr'* *E595* 'showbreak' 'sbr' string (default "") global @@ -5683,10 +5624,18 @@ A jump table for the options with a short description can be found at |Q_op|. Example: Try this together with 'sidescroll' and 'listchars' as in the following example to never allow the cursor to move - onto the "extends" character: + onto the "extends" character: > :set nowrap sidescroll=1 listchars=extends:>,precedes:< :set sidescrolloff=1 +< + *'signcolumn'* *'scl'* +'signcolumn' 'scl' string (default "auto") + local to window + Whether or not to draw the signcolumn. Valid values are: + "auto" only when there is a sign to display + "no" never + "yes" always *'smartcase'* *'scs'* *'nosmartcase'* *'noscs'* @@ -5837,9 +5786,6 @@ A jump table for the options with a short description can be found at |Q_op|. (_xx is an underscore, two letters and followed by a non-letter). This is mainly for testing purposes. You must make sure the correct encoding is used, Vim doesn't check it. - When 'encoding' is set the word lists are reloaded. Thus it's a good - idea to set 'spelllang' after setting 'encoding' to avoid loading the - files twice. How the related spell files are found is explained here: |spell-load|. If the |spellfile.vim| plugin is active and you use a language name @@ -5955,7 +5901,7 @@ A jump table for the options with a short description can be found at |Q_op|. The option consists of printf style '%' items interspersed with normal text. Each status line item is of the form: %-0{minwid}.{maxwid}{item} - All fields except the {item} is optional. A single percent sign can + All fields except the {item} are optional. A single percent sign can be given as "%%". Up to 80 items can be specified. *E541* When the option starts with "%!" then it is used as an expression, @@ -6068,7 +6014,8 @@ A jump table for the options with a short description can be found at |Q_op|. feature use `has('tablineat')`. < - Where to truncate line if too long. Default is at the start. No width fields allowed. - = - Separation point between left and right aligned items. + = - Separation point between alignment sections. Each section will + be separated by an equal number of spaces. No width fields allowed. # - Set highlight group. The name must follow and then a # again. Thus use %#HLname# for highlight group HLname. The same @@ -6179,9 +6126,6 @@ A jump table for the options with a short description can be found at |Q_op|. This option is used together with 'bufhidden' and 'buftype' to specify special kinds of buffers. See |special-buffers|. - *'swapsync'* *'sws'* -'swapsync' 'sws' Removed. |vim-differences| {Nvim} - *'switchbuf'* *'swb'* 'switchbuf' 'swb' string (default "") global @@ -6405,9 +6349,6 @@ A jump table for the options with a short description can be found at |Q_op|. Resetting this option is useful when using a ":tag" command in a mapping which should not change the tagstack. - *'term'* *E529* *E530* *E531* -'term' Removed. |vim-differences| {Nvim} - *'termbidi'* *'tbidi'* *'notermbidi'* *'notbidi'* 'termbidi' 'tbidi' boolean (default off) @@ -6421,9 +6362,6 @@ A jump table for the options with a short description can be found at |Q_op|. 'arabicshape' is ignored, but 'rightleft' isn't changed automatically. For further details see |arabic.txt|. - *'termencoding'* *'tenc'* -'termencoding' 'tenc' Removed. |vim-differences| {Nvim} - *'termguicolors'* *'tgc'* 'termguicolors' 'tgc' boolean (default off) global @@ -6461,6 +6399,7 @@ A jump table for the options with a short description can be found at |Q_op|. non-keyword characters (white space is preferred). Maximum line length is 510 bytes. To obtain a file to be used here, check out this ftp site: + [Sorry this link doesn't work anymore, do you know the right one?] ftp://ftp.ox.ac.uk/pub/wordlists/ First get the README file. To include a comma in a file name precede it with a backslash. Spaces after a comma are ignored, otherwise spaces are included in the file @@ -6577,28 +6516,10 @@ A jump table for the options with a short description can be found at |Q_op|. to be garbled (e.g., when it contains a CR or NL character). {not available when compiled without the |+statusline| feature} - *'toolbar'* *'tb'* -'toolbar' 'tb' Removed. |vim-differences| {Nvim} - - *'toolbariconsize'* *'tbis'* -'toolbariconsize' 'tbis' Removed. |vim-differences| {Nvim} - - *'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'* -'ttybuiltin' 'tbi' Removed. |vim-differences| {Nvim} - *'ttyfast'* *'tf'* *'nottyfast'* *'notf'* 'ttyfast' 'tf' Removed. |vim-differences| {Nvim} - *'ttymouse'* *'ttym'* -'ttymouse' 'ttym' Removed. |vim-differences| {Nvim} - - *'ttyscroll'* *'tsl'* -'ttyscroll' 'tsl' Removed. |vim-differences| {Nvim} - - *'ttytype'* *'tty'* -'ttytype' 'tty' Alias for 'term'. Removed. |vim-differences| {Nvim} - - *'undodir'* *'udir'* *E926* + *'undodir'* *'udir'* *E5003* 'undodir' 'udir' string (default "$XDG_DATA_HOME/nvim/undo") global {only when compiled with the |+persistent_undo| feature} @@ -6752,12 +6673,6 @@ A jump table for the options with a short description can be found at |Q_op|. with Unix. The Unix version of Vim cannot source dos format scripts, but the Windows version of Vim can source unix format scripts. - *'viminfo'* *'vi'* -'viminfo' 'vi' string - global - Deprecated alias for 'shada' option. Is kept for compatibility - reasons. - *'virtualedit'* *'ve'* 'virtualedit' 've' string (default "") global @@ -6803,9 +6718,6 @@ A jump table for the options with a short description can be found at |Q_op|. Give a warning message when a shell command is used while the buffer has been changed. - *'weirdinvert'* *'wiv'* *'noweirdinvert'* *'nowiv'* -'weirdinvert' 'wiv' Removed. |vim-differences| {Nvim} - *'whichwrap'* *'ww'* 'whichwrap' 'ww' string (Vim default: "b,s", Vi default: "") global @@ -7162,7 +7074,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'writedelay'* *'wd'* 'writedelay' 'wd' number (default 0) global - The number of microseconds to wait for each character sent to the + The number of milliseconds to wait for each character sent to the screen. When non-zero, characters are sent to the terminal one by one. For debugging purposes. diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt index 3c7ca4e36a..5dc276c9df 100644 --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -1,4 +1,4 @@ -*os_win32.txt* For Vim version 7.4. Last change: 2014 Sep 25 +*os_win32.txt* For Vim version 7.4. Last change: 2016 Mar 05 VIM REFERENCE MANUAL by George Reilly @@ -75,6 +75,31 @@ The directory of the Vim executable is appended to $PATH. This is mostly to make "!xxd" work, as it is in the Tools menu. And it also means that when executable() returns 1 the executable can actually be executed. +Quotes in file names *win32-quotes* + +Quotes inside a file name (or any other command line argument) can be escaped +with a backslash. E.g. > + vim -c "echo 'foo\"bar'" + +Alternatively use three quotes to get one: > + vim -c "echo 'foo"""bar'" + +The quotation rules are: + +1. A `"` starts quotation. +2. Another `"` or `""` ends quotation. If the quotation ends with `""`, a `"` + is produced at the end of the quoted string. + +Examples, with [] around an argument: + "foo" -> [foo] + "foo"" -> [foo"] + "foo"bar -> [foobar] + "foo" bar -> [foo], [bar] + "foo""bar -> [foo"bar] + "foo"" bar -> [foo"], [bar] + "foo"""bar" -> [foo"bar] + + ============================================================================== 3. Using the mouse *win32-mouse* diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 5897f756d8..f3f5bcbd66 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.4. Last change: 2016 Jan 03 +*pattern.txt* For Vim version 7.4. Last change: 2016 Jun 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -573,7 +573,7 @@ An atom can be followed by an indication of how many times the atom can be matched and in what way. This is called a multi. See |/multi| for an overview. - */star* */\star* *E56* + */star* */\star* * (use \* when 'magic' is not set) Matches 0 or more of the preceding atom, as many as possible. Example 'nomagic' matches ~ @@ -593,7 +593,7 @@ overview. the end of the file and then tries matching "END", backing up one character at a time. - */\+* *E57* + */\+* \+ Matches 1 or more of the preceding atom, as many as possible. Example matches ~ ^.\+$ any non-empty line @@ -608,7 +608,7 @@ overview. \? Just like \=. Cannot be used when searching backwards with the "?" command. - */\{* *E58* *E60* *E554* *E870* + */\{* *E60* *E554* *E870* \{n,m} Matches n to m of the preceding atom, as many as possible \{n} Matches n of the preceding atom \{n,} Matches at least n of the preceding atom, as many as possible @@ -947,14 +947,18 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): < When 'hlsearch' is set and you move the cursor around and make changes this will clearly show when the match is updated or not. To match the text up to column 17: > - /.*\%17v -< Column 17 is included, because that's where the "\%17v" matches, - even though this is a |/zero-width| match. Adding a dot to match the - next character has the same result: > - /.*\%17v. + /^.*\%17v +< Column 17 is not included, because this is a |/zero-width| match. To + include the column use: > + /^.*\%17v. < This command does the same thing, but also matches when there is no character in column 17: > - /.*\%<18v. + /^.*\%<18v. +< Note that without the "^" to anchor the match in the first column, + this will also highlight column 17: > + /.*\%17v +< Column 17 is highlighted by 'hlsearch' because there is another match + where ".*" matches zero characters. < Character classes: @@ -1071,8 +1075,8 @@ x A single character, with no special meaning, matches itself belonging to that character class. The following character classes are supported: Name Contents ~ -*[:alnum:]* [:alnum:] letters and digits -*[:alpha:]* [:alpha:] letters +*[:alnum:]* [:alnum:] ASCII letters and digits +*[:alpha:]* [:alpha:] ASCII letters *[:blank:]* [:blank:] space and tab characters *[:cntrl:]* [:cntrl:] control characters *[:digit:]* [:digit:] decimal digits @@ -1080,7 +1084,7 @@ x A single character, with no special meaning, matches itself *[:lower:]* [:lower:] lowercase letters (all letters when 'ignorecase' is used) *[:print:]* [:print:] printable characters including space -*[:punct:]* [:punct:] punctuation characters +*[:punct:]* [:punct:] ASCII punctuation characters *[:space:]* [:space:] whitespace characters *[:upper:]* [:upper:] uppercase letters (all letters when 'ignorecase' is used) @@ -1096,8 +1100,9 @@ x A single character, with no special meaning, matches itself '/', alphabetic, numeric, '_' or '~'. These items only work for 8-bit characters, except [:lower:] and [:upper:] also work for multi-byte characters when using the new - regexp engine. In the future these items may work for multi-byte - characters. + regexp engine. See |two-engines|. In the future these items may + work for multi-byte characters. For now, to get all "alpha" + characters you can use: [[:lower:][:upper:]]. */[[=* *[==]* - An equivalence class. This means that characters are matched that have almost the same meaning, e.g., when ignoring accents. This diff --git a/runtime/doc/pi_health.txt b/runtime/doc/pi_health.txt new file mode 100644 index 0000000000..69833103d1 --- /dev/null +++ b/runtime/doc/pi_health.txt @@ -0,0 +1,127 @@ +*pi_health.txt* Healthcheck framework + +Author: TJ DeVries <devries.timothyj@gmail.com> + +============================================================================== +1. Introduction |health.vim-intro| +2. Commands and functions |health.vim-manual| +3. Create a healthcheck |health.vim-dev| + +============================================================================== +Introduction *healthcheck* *health.vim-intro* + +Troubleshooting user configuration problems is a time-consuming task that +developers want to minimize. health.vim provides a simple framework for plugin +authors to hook into, and for users to invoke, to check and report the user's +configuration and environment. Type this command to try it: > + + :CheckHealth +< +For example, some users have broken or unusual Python setups, which breaks the +|:python| command. |:CheckHealth| detects several common Python configuration +problems and reports them. If the Neovim Python module is not installed, it +shows a warning: > + + You have not installed the Neovim Python module + You might want to try `pip install Neovim` +< +Plugin authors are encouraged to add healthchecks, see |health.vim-dev|. + +============================================================================== +Commands and functions *health.vim-manual* + +Commands +------------------------------------------------------------------------------ + *:CheckHealth* +:CheckHealth Run all healthchecks and show the output in a new + tabpage. These healthchecks are included by default: + - python2 + - python3 + - ruby + - remote plugin + +:CheckHealth {plugins} + Run healthchecks for one or more plugins. E.g. to run + only the standard Nvim healthcheck: > + :CheckHealth nvim +< To run the healthchecks for the "foo" and "bar" plugins + (assuming these plugins are on your 'runtimepath' and + they have implemented health#foo#check() and + health#bar#check(), respectively): > + :CheckHealth foo bar +< +Functions +------------------------------------------------------------------------------ + +health.vim functions are for creating new healthchecks. They mostly just do +some layout and formatting, to give users a consistent presentation. + +health#report_start({name}) *health#report_start* + Starts a new report. Most plugins should call this only once, but if + you want different sections to appear in your report, call this once + per section. + +health#report_info({msg}) *health#report_info* + Displays an informational message. + +health#report_ok({msg}) *health#report_ok* + Displays a "success" message. + +health#report_warn({msg}, [{suggestions}]) *health#report_warn* + Displays a warning. {suggestions} is an optional List of suggestions. + +health#report_error({msg}, [{suggestions}]) *health#report_error* + Displays an error. {suggestions} is an optional List of suggestions. + +health#{plugin}#check() *health.user_checker* + This is the form of a healthcheck definition. Call the above functions + from this function, then |:CheckHealth| does the rest. Example: > + + function! health#my_plug#check() abort + silent call s:check_environment_vars() + silent call s:check_python_configuration() + endfunction +< + The function will be found and called automatically when the user + invokes |:CheckHealth|. + + All output will be captured from the healthcheck. Use the + health#report_* functions so that your healthcheck has a format + consistent with the standard healthchecks. + +============================================================================== +Create a healthcheck *health.vim-dev* + +Healthchecks are functions that check the health of the system. Neovim has +built-in checkers, found in $VIMRUNTIME/autoload/health/. + +To add a new checker for your own plugin, simply define a +health#{plugin}#check() function in autoload/health/{plugin}.vim. +|:CheckHealth| automatically finds and invokes such functions. + +If your plugin is named "jslint", then its healthcheck function must be > + + health#jslint#check() +< +defined in this file on 'runtimepath': > + + autoload/health/jslint.vim +< +Here's a sample to get started: > + + function! health#jslint#check() abort + call health#report_start('sanity checks') + " perform arbitrary checks + " ... + + if looks_good + call health#report_ok('found required dependencies') + else + call health#report_error('cannot find jslint', + \ ['npm install --save jslint']) + endif + endfunction +< +============================================================================== + +vim:tw=78:ts=8:ft=help:fdm=marker diff --git a/runtime/doc/pi_msgpack.txt b/runtime/doc/pi_msgpack.txt index 95d6ff7467..d695ac42cb 100644 --- a/runtime/doc/pi_msgpack.txt +++ b/runtime/doc/pi_msgpack.txt @@ -128,6 +128,11 @@ msgpack#eval({string}, {dict}) *msgpack#eval()* always evaluated to |msgpack-special-dict| values, as well as hexadecimal digits. When evaluating maps order of keys is preserved. + Note that in addition to regular integer representations that may be + obtained using |msgpack#string()| msgpack#eval() also supports C-style + “character†integer constants like `'/'` (equivalent to + `char2nr('/')`: `47`). This also allows `'\0'` (number is decimal). + *msgpack#equal* msgpack#equal({msgpack-value}, {msgpack-value}) *msgpack#equal()* Returns 1 if given values are equal, 0 otherwise. When comparing diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 1705010ff2..f740143c61 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.4. Last change: 2015 Oct 31 +*pi_netrw.txt* For Vim version 7.4. Last change: 2016 Apr 20 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -6,7 +6,7 @@ Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 1999-2015 Charles E Campbell *netrw-copyright* +Copyright: Copyright (C) 2016 Charles E Campbell *netrw-copyright* The VIM LICENSE applies to the files in this package, including netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and syntax/netrw.vim. Like anything else that's free, netrw.vim and its @@ -48,9 +48,10 @@ Copyright: Copyright (C) 1999-2015 Charles E Campbell *netrw-copyright* Introduction To Browsing............................|netrw-intro-browse| Quick Reference: Maps...............................|netrw-browse-maps| Quick Reference: Commands...........................|netrw-browse-cmds| + Banner Display......................................|netrw-I| Bookmarking A Directory.............................|netrw-mb| Browsing............................................|netrw-cr| - Squeezing the Current Tree-Listing Directory......|:netrw-s-cr| + Squeezing the Current Tree-Listing Directory........|netrw-s-cr| Browsing With A Horizontally Split Window...........|netrw-o| Browsing With A New Tab.............................|netrw-t| Browsing With A Vertically Split Window.............|netrw-v| @@ -75,11 +76,13 @@ Copyright: Copyright (C) 1999-2015 Charles E Campbell *netrw-copyright* Making The Browsing Directory The Current Directory.|netrw-c| Marking Files.......................................|netrw-mf| Unmarking Files.....................................|netrw-mF| + Marking Files By Location List......................|netrw-qL| Marking Files By QuickFix List......................|netrw-qF| Marking Files By Regular Expression.................|netrw-mr| Marked Files: Arbitrary Shell Command...............|netrw-mx| Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX| Marked Files: Arbitrary Vim Command.................|netrw-mv| + Marked Files: Argument List.........................|netrw-ma| |netrw-mA| Marked Files: Compression And Decompression.........|netrw-mz| Marked Files: Copying...............................|netrw-mc| Marked Files: Diff..................................|netrw-md| @@ -1111,6 +1114,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 qb List bookmarked directories and history |netrw-qb| qf Display information on file |netrw-qf| qF Mark files using a quickfix list |netrw-qF| + qL Mark files using a |location-list| |netrw-qL| r Reverse sorting order |netrw-r| R Rename the designated file(s)/directory(ies) |netrw-R| s Select sorting style: by name, time, or file size |netrw-s| @@ -1160,6 +1164,14 @@ QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore| :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| + +BANNER DISPLAY *netrw-I* + +One may toggle the banner display on and off by pressing "I". + +Also See: |g:netrw_banner| + + BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 One may easily "bookmark" the currently browsed directory by using > @@ -1201,7 +1213,7 @@ Related Topics: |g:netrw_home| controls where .netrwbook is kept -BROWSING *netrw-cr* {{{2 +BROWSING *netrw-enter* *netrw-cr* {{{2 Browsing is simple: move the cursor onto a file or directory of interest. Hitting the <cr> (the return key) will select the file or directory. @@ -1242,11 +1254,21 @@ The price for such re-use is that when changes are made (such as new files are introduced into a directory), the listing may become out-of-date. One may always refresh directory listing buffers by pressing ctrl-L (see |netrw-ctrl-l|). - *:netrw-s-cr* - Squeezing the Current Tree-Listing Directory~ - When the tree listing style is enabled (see |netrw-i|) and one is using - gvim, then the <s-cr> mapping may be used to squeeze (close) the - directory currently containing the cursor. + + *netrw-s-cr* +Squeezing the Current Tree-Listing Directory~ + +When the tree listing style is enabled (see |netrw-i|) and one is using +gvim, then the <s-cr> mapping may be used to squeeze (close) the +directory currently containing the cursor. + +Otherwise, one may remap a key combination of one's own choice to get +this effect: > + + nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze +< +Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated +for netrw buffers only. Related topics: |netrw-ctrl-r| |netrw-o| |netrw-p| @@ -1495,11 +1517,13 @@ One may also use visual mode (see |visual-start|) to select the text that the special handler will use. Normally gx uses expand("<cfile>") to pick up the text under the cursor; one may change what |expand()| uses via the |g:netrw_gx| variable. Alternatively, one may select the text to be used by -gx via first making a visual selection (see |visual-block|). +gx via first making a visual selection (see |visual-block|) or by changing +the |'isfname'| option (which is global, so netrw doesn't modify it). Associated setting variables: |g:netrw_gx| control how gx picks up the text under the cursor |g:netrw_nogx| prevent gx map while editing + |g:netrw_suppress_gx_mesg| controls gx's suppression of browser messages *netrw_filehandler* @@ -1713,8 +1737,9 @@ Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize| EXPLORING WITH STARS AND PATTERNS {{{2 When Explore, Sexplore, Hexplore, or Vexplore are used with one of the -following four patterns Explore generates a list of files which satisfy -the request. > +following four patterns Explore generates a list of files which satisfy the +request for the local file system. These exploration patterns will not work +with remote file browsing. */filepat files in current directory which satisfy filepat **/filepat files in current directory or below which satisfy the @@ -2079,15 +2104,22 @@ Netrw provides several ways to mark files: :MF *.c < - * Note that :MF uses |<f-args>| to break the line - at spaces. + (Note that :MF uses |<f-args>| to break the line + at spaces) + + * Mark files using the |argument-list| (|netrw-mA|) + + * Mark files based upon a |location-list| (|netrw-qL|) * Mark files based upon the quickfix list (|netrw-qF|) + (|quickfix-error-lists|) The following netrw maps make use of marked files: |netrw-a| Hide marked files/directories |netrw-D| Delete marked files/directories + |netrw-ma| Move marked files' names to |arglist| + |netrw-mA| Move |arglist| filenames to marked file list |netrw-mb| Append marked files to bookmarks |netrw-mB| Delete marked files from bookmarks |netrw-mc| Copy marked files to target @@ -2146,8 +2178,14 @@ UNMARKING FILES *netrw-mF* {{{2 The "mF" command will unmark all files in the current buffer. One may also use mf (|netrw-mf|) on a specific, already marked, file to unmark just that file. +MARKING FILES BY LOCATION LIST *netrw-qL* {{{2 + (also see |netrw-mf|) + +One may convert |location-list|s into a marked file list using "qL". +You may then proceed with commands such as me (|netrw-me|) to edit them. -MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2 + +MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2 (also see |netrw-mf|) One may convert |quickfix-error-lists| into a marked file list using "qF". @@ -2223,6 +2261,16 @@ The command that will be run with this example: tar cf mynewtarball.tar 'file1' 'file2' ... +MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA* + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked-file list) + +Using ma, one moves filenames from the marked file list to the argument list. +Using mA, one moves filenames from the argument list to the marked file list. + +See Also: |netrw-qF| |argument-list| |:args| + + MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked file list) @@ -2232,7 +2280,7 @@ If any marked files are decompressed, then "mz" will compress them using the command specified by |g:netrw_compress|; by default, that's "gzip". -For decompression, netrw provides a |Dictionary| of suffices and their +For decompression, netrw uses a |Dictionary| of suffices and their associated decompressing utilities; see |g:netrw_decompress|. Remember that one can mark multiple files by regular expression @@ -2287,7 +2335,7 @@ The command will ask for the requested pattern; one may then enter: > pattern < With /pattern/, editing will start with the first item on the |quickfix| list -that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|). The |:vimgrep| +that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep| command is in use, so without 'g' each line is added to quickfix list only once; with 'g' every match is included. @@ -2756,6 +2804,16 @@ your browsing preferences. (see also: |netrw-settings|) evaluation will be suppressed (see |'ballooneval'|) + *g:netrw_sizestyle* not defined: actual bytes (default) + ="b" : actual bytes (default) + ="h" : human-readable (ex. 5k, 4m, 3g) + uses 1000 base + ="H" : human-readable (ex. 5K, 4M, 3G) + uses 1024 base + The long listing (|netrw-i|) and query-file + maps (|netrw-qf|) will display file size + using the specified style. + *g:netrw_usetab* if this variable exists and is non-zero, then the <tab> map supporting shrinking/expanding a Lexplore or netrw window will be enabled. @@ -2872,6 +2930,13 @@ your browsing preferences. (see also: |netrw-settings|) such as listing, file removal, etc. default: ssh + *g:netrw_suppress_gx_mesg* =1 : browsers sometimes produce messages + which are normally unwanted intermixed + with the page. + However, when using links, for example, + those messages are what the browser produces. + By setting this option to 0, netrw will not + suppress browser messages. *g:netrw_tmpfile_escape* =' &;' escape() is applied to all temporary files @@ -3024,14 +3089,14 @@ These will: Related: if you like this idea, you may also find :Lexplore (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest -Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| +Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| |CTRL-W_z| |:pclose| PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 -To edit a file or directory in the previously used (last accessed) window (see -:he |CTRL-W_p|), press a "P". If there's only one window, then the one window -will be horizontally split (by default). +To edit a file or directory under the cursor in the previously used (last +accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one +window, then the one window will be horizontally split (by default). If there's more than one window, the previous window will be re-used on the selected file/directory. If the previous window's associated buffer @@ -3170,7 +3235,7 @@ only if your terminal supports differentiating <c-tab> from a plain * Else bring up a |:Lexplore| window If |g:netrw_usetab| exists or is zero, or if there is a pre-existing mapping -for <c-tab>, then the <tab> will not be mapped. One may map something other +for <c-tab>, then the <c-tab> will not be mapped. One may map something other than a <c-tab>, too: (but you'll still need to have had g:netrw_usetab set) > nmap <unique> (whatever) <Plug>NetrwShrink @@ -3637,13 +3702,13 @@ called netrw.vimrc with the following contents: > < Then run netrw as follows: > - vim -u netrw.vimrc --noplugins [some path here] + vim -u netrw.vimrc --noplugins -i NONE [some path here] < Perform whatever netrw commands you need to, and check that the problem is still present. This procedure sidesteps any issues due to personal .vimrc -settings and other plugins. If the problem does not appear, then you need -to determine what setting in your .vimrc is causing the conflict with netrw -or which plugin. +settings, .viminfo file, and other plugins. If the problem does not appear, +then you need to determine which setting in your .vimrc is causing the +conflict with netrw or which plugin(s) is/are involved. Step 3: If the problem still is present, then get a debugging trace from netrw: @@ -3698,6 +3763,54 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 + v156: Feb 18, 2016 * Changed =~ to =~# where appropriate + Feb 23, 2016 * s:ComposePath(base,subdir) now uses + fnameescape() on the base portion + Mar 01, 2016 * (gt_macki) reported where :Explore would + make file unlisted. Fixed (tst943) + Apr 04, 2016 * (reported by John Little) netrw normally + suppresses browser messages, but sometimes + those "messages" are what is wanted. + See |g:netrw_suppress_gx_mesg| + Apr 06, 2016 * (reported by Carlos Pita) deleting a remote + file was giving an error message. Fixed. + Apr 08, 2016 * (Charles Cooper) had a problem with an + undefined b:netrw_curdir. He also provided + a fix. + Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses + dictionaries. Also fixed the "No Name" + buffer problem. + v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's + mapping of ctrl-l was not allowing refresh of + other windows when it was done in a netrw + window. + Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search() + instead of a loop + * NetrwBrowse() will return line to + w:netrw_bannercnt if cursor ended up in + banner + Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|) + Nov 17, 2015 * Commented out imaps -- perhaps someone can + tell me how they're useful and should be + retained? + Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support + Nov 20, 2015 * gx (|netrw-gx|) on an url downloaded the + file in addition to simply bringing up the + url in a browser. Fixed. + Nov 23, 2015 * Added |g:netrw_sizestyle| support + Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw + maps. + Jan 05, 2016 * |netrw-qL| implemented to mark files based + upon |location-list|s; similar to |netrw-qF|. + Jan 19, 2016 * using - call delete(directoryname,"d") - + instead of using g:netrw_localrmdir if + v7.4 + patch#1107 is available + Jan 28, 2016 * changed to using |winsaveview()| and + |winrestview()| + Jan 28, 2016 * s:NetrwTreePath() now does a save and + restore of view + Feb 08, 2016 * Fixed a tree-listing problem with remote + directories v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where a file was not treated properly as a file due to g:netrw_keepdir == 1 @@ -3858,7 +3971,7 @@ netrw: handling. * |:Lexplore| path: will be used to update a left-side netrw browsing directory. - Mar 12, 2014 * |:netrw-s-cr|: use <s-cr> to close + Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close tree directory implemented Mar 13, 2014 * (Tony Mechylynck) reported that using the browser with ftp on a directory, diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt new file mode 100644 index 0000000000..3cd53e3e50 --- /dev/null +++ b/runtime/doc/provider.txt @@ -0,0 +1,133 @@ +*provider.txt* {Nvim} + + + NVIM REFERENCE MANUAL by Thiago de Arruda + + +Providers *provider* + +Nvim delegates some features to dynamic "providers". + +============================================================================== +Python integration *provider-python* + +Nvim supports the Vim legacy |python-vim| and |python3| interfaces via +external Python interpreters connected via |RPC|. +Note: Only the Vim 7.3 API is supported; bindeval (Vim 7.4) is not. + +PYTHON QUICKSTART ~ + +If you used a package manager to install Nvim, you might already have the +required `neovim` Python package. Run |:CheckHealth| to see if your system is +up-to-date. + +Following are steps to install the package with Python's `pip` tool. + +Note: Depending on your system, `pip` might refer to Python 2 or Python 3, + which is why the following instructions mention `pip2` or `pip3` + explicitly. If one of these is not available, try `pip`. + +To use Vim Python 2/3 plugins with Nvim: + +- For Python 2 plugins, make sure an interpreter for Python 2.6 or 2.7 is + available in your `$PATH`, then install the `neovim` Python package systemwide: > + $ sudo pip2 install --upgrade neovim +< + or for the current user: > + $ pip2 install --user --upgrade neovim +< +- For Python 3 plugins, make sure an interpreter for Python 3.3 or above is + available in your `$PATH`, then install the `neovim` Python package systemwide: > + $ sudo pip3 install --upgrade neovim +< + or for the current user: > + $ pip3 install --user --upgrade neovim +< +Note: The `--upgrade` flag ensures you have the latest version even if + a previous version was already installed. + +PYTHON PROVIDER CONFIGURATION ~ + *g:python_host_prog* + *g:python3_host_prog* +Program to use for evaluating Python code. Setting this makes startup faster. > + let g:python_host_prog = '/path/to/python' + let g:python3_host_prog = '/path/to/python3' +< + *g:loaded_python_provider* +To disable Python 2 support: > + let g:loaded_python_provider = 1 +< + *g:loaded_python3_provider* +To disable Python 3 support: > + let g:loaded_python3_provider = 1 + + +============================================================================== +Ruby integration *provider-ruby* + +Nvim supports the Vim legacy |ruby-vim| interface via external Ruby +interpreters connected via |RPC|. + +Run |:CheckHealth| to see if your system is up-to-date. + +RUBY QUICKSTART ~ + +To use Vim Ruby plugins with Nvim, just install the latest `neovim` RubyGem: > + $ gem install neovim + +RUBY PROVIDER CONFIGURATION ~ + *g:loaded_ruby_provider* +To disable Ruby support: > + let g:loaded_ruby_provider = 1 + + +============================================================================== +Clipboard integration *provider-clipboard* *clipboard* + +Nvim has no direct connection to the system clipboard. Instead it is +accessible through a |provider| which transparently uses shell commands for +communicating with the clipboard. + +Clipboard access is implicitly enabled if any of the following clipboard tools +are found in your `$PATH`. + + - xclip + - xsel (newer alternative to xclip) + - pbcopy/pbpaste (Mac OS X) + - lemonade (for SSH) https://github.com/pocke/lemonade + - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ + +The presence of a suitable clipboard tool implicitly enables the '+' and '*' +registers. + +If you want to ALWAYS use the clipboard for ALL operations (as opposed +to interacting with the '+' and/or '*' registers explicitly), set the +following option: +> + set clipboard+=unnamedplus +< +See 'clipboard' for details and more options. + +============================================================================== +X11 selection mechanism *clipboard-x11* *x11-selection* + +The clipboard providers for X11 store text in what is known as "selections". +Selections are "owned" by an application, so when the application is closed, +the selection text is lost. + +The contents of selections are held by the originating application (e.g., upon +a copy), and only passed on to another application when that other application +asks for them (e.g., upon a paste). + + *quoteplus* *quote+* + +There are three documented X11 selections: `PRIMARY`, `SECONDARY`, and `CLIPBOARD`. +`CLIPBOARD` is typically used in X11 applications for copy/paste operations +(`Ctrl-c`/`v`), while `PRIMARY` is used for the last selected text, which is +generally inserted with the middle mouse button. + +Nvim's X11 clipboard providers only utilize the `PRIMARY` and `CLIPBOARD` +selections, used for the '*' and '+' registers, respectively. + +============================================================================== + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index ff4fded0d9..0b7907e364 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 7.4. Last change: 2015 Sep 08 +*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,10 +30,14 @@ positions in files. For example, |:vimgrep| finds pattern matches. You can use the positions in a script with the |getqflist()| function. Thus you can do a lot more than the edit/compile/fix cycle! -You should save your compiler's error messages to a file and start vim with -"vim -q filename". An easy way to do this is with the |:make| command (see -below). The 'errorformat' option should be set to match the error messages -from your compiler (see |errorformat| below). +If you have the error messages in a file you can start Vim with: > + vim -q filename + +From inside Vim an easy way to run a command and handle the output is with the +|:make| command (see below). + +The 'errorformat' option should be set to match the error messages from your +compiler (see |errorformat| below). *location-list* *E776* A location list is similar to a quickfix list and contains a list of positions @@ -42,13 +46,21 @@ have a separate location list. A location list can be associated with only one window. The location list is independent of the quickfix list. When a window with a location list is split, the new window gets a copy of the -location list. When there are no references to a location list, the location -list is destroyed. +location list. When there are no longer any references to a location list, +the location list is destroyed. The following quickfix commands can be used. The location list commands are similar to the quickfix commands, replacing the 'c' prefix in the quickfix command with 'l'. + *E924* +If the current window was closed by an |autocommand| while processing a +location list command, it will be aborted. + + *E925* *E926* +If the current quickfix or location list was changed by an |autocommand| while +processing a quickfix or location list command, it will be aborted. + *:cc* :cc[!] [nr] Display error [nr]. If [nr] is omitted, the same error is displayed again. Without [!] this doesn't @@ -255,9 +267,23 @@ command with 'l'. The 'switchbuf' settings are respected when jumping to a buffer. +:cl[ist] +{count} List the current and next {count} valid errors. This + is similar to ":clist from from+count", where "from" + is the current error position. + :cl[ist]! [from] [, [to]] List all errors. +:cl[ist]! +{count} List the current and next {count} error lines. This + is useful to see unrecognized lines after the current + one. For example, if ":clist" shows: + 8384 testje.java:252: error: cannot find symbol ~ + Then using ":cl! +3" shows the reason: + 8384 testje.java:252: error: cannot find symbol ~ + 8385: ZexitCode = Fmainx(); ~ + 8386: ^ ~ + 8387: symbol: method Fmainx() ~ + *:lli* *:llist* :lli[st] [from] [, [to]] Same as ":clist", except the location list for the @@ -302,7 +328,7 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: etc. < When the current file can't be |abandon|ed and the [!] is not present, the command fails. - When an error is detected excecution stops. + When an error is detected execution stops. The last buffer (or where an error occurred) becomes the current buffer. {cmd} can contain '|' to concatenate several commands. @@ -406,6 +432,17 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: :lw[indow] [height] Same as ":cwindow", except use the window showing the location list for the current window. + *:cbo* *:cbottom* +:cbo[ttom] Put the cursor in the last line of the quickfix window + and scroll to make it visible. This is useful for + when errors are added by an asynchronous callback. + Only call it once in a while if there are many + updates to avoid a lot of redrawing. + + *:lbo* *:lbottom* +:lbo[ttom] Same as ":cbottom", except use the window showing the + location list for the current window. + Normally the quickfix window is at the bottom of the screen. If there are vertical splits, it's at the bottom of the rightmost column of windows. To make it always occupy the full width: > @@ -441,6 +478,9 @@ expression. The BufWinEnter event is also triggered, again using "quickfix" for the buffer name. +Note: When adding to an existing quickfix list the autocommand are not +triggered. + Note: Making changes in the quickfix window has no effect on the list of errors. 'modifiable' is off to avoid making changes. If you delete or insert lines anyway, the relation between the text and the error number is messed up. @@ -1489,12 +1529,6 @@ However, to properly parse such a complex file, an external filter should be used. See the description further above how to make such a filter known by Vim. - *errorformat-Perl* -In $VIMRUNTIME/tools you can find the efm_perl.pl script, which filters Perl -error messages into a format that quickfix mode will understand. See the -start of the file about how to use it. (This script is deprecated, see -|compiler-perl|.) - vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 8e40628e25..a7644fab84 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 7.4. Last change: 2015 Nov 10 +*quickref.txt* For Vim version 7.4. Last change: 2016 Aug 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -794,6 +794,7 @@ Short explanation of each option: *option-list* 'omnifunc' 'ofu' function for filetype-specific completion 'opendevice' 'odev' allow reading/writing devices on MS-Windows 'operatorfunc' 'opfunc' function to be called for |g@| operator +'packpath' 'pp' list of directories used for packages 'paragraphs' 'para' nroff macros that separate paragraphs 'paste' allow pasting text 'pastetoggle' 'pt' key code that causes 'paste' to toggle @@ -812,6 +813,7 @@ Short explanation of each option: *option-list* 'printmbcharset' 'pmbcs' CJK character set to be used for :hardcopy 'printmbfont' 'pmbfn' font names to be used for CJK output of :hardcopy 'printoptions' 'popt' controls the format of :hardcopy output +'prompt' 'prompt' enable prompt in Ex mode 'pumheight' 'ph' maximum height of the popup menu 'pythondll' name of the Python 2 dynamic library 'pythonthreedll' name of the Python 3 dynamic library @@ -860,6 +862,7 @@ Short explanation of each option: *option-list* 'showtabline' 'stal' tells when the tab pages line is displayed 'sidescroll' 'ss' minimum number of columns to scroll horizontal 'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor +'signcolumn' 'scl' when to display the sign column 'smartcase' 'scs' no ignore case when pattern has uppercase 'smartindent' 'si' smart autoindenting for C programs 'smarttab' 'sta' use 'shiftwidth' when inserting <Tab> diff --git a/runtime/doc/quotes.txt b/runtime/doc/quotes.txt deleted file mode 100644 index c35fb2f139..0000000000 --- a/runtime/doc/quotes.txt +++ /dev/null @@ -1,275 +0,0 @@ -*quotes.txt* For Vim version 7.4. Last change: 2010 Nov 03 - - - VIM REFERENCE MANUAL by Bram Moolenaar - - - *quotes* -Here are some nice quotes about Vim that I collected from news and mail. - - -vim (vim) noun - Ebullient vitality and energy. [Latin, accusative of vis, -strength] (Dictionary) - -Vim is so much better than vi that a great many of my old vi :map's became -immediately obsolete! (Tony Nugent, Australia) - -Coming with a very GUI mindset from Windows, I always thought of people using -Vi as some kind of outer space alien in human clothes. Once I tried I really -got addicted by its power and now I found myself typing Vim keypresses in the -oddest places! That's why I would like to see Vim embedded in every -application which deals with text editing. (José Fonseca) - -I was a 12-year emacs user who switched to Vim about a year ago after finally -giving up on the multiple incompatible versions, flaky contributed packages, -disorganized keystrokes, etc. And it was one of the best moves I ever made. -(Joel Burton) - -Although all of the programs were used during the preparation of the new and -revised material, most of the editing was done with Vim versions 4.5 and 5.0 -under GNU-Linux (Redhat 4.2). (Arnold Robbins, Israel, author of "Learning -the Vi editor") - -Out of all the open software i've ever seen and used, and i've seen a lot, Vim -is the best, most useful and highest quality to work with, second only to the -linux kernel itself. (Peter Jay Salzman) - -It's well worth noting that the _entirety_ of SourceForge was written using -Vim and its nifty PHP syntax highlighting. I think the entire SF.net tech -staff uses Vim and we're all excited to have you aboard! (Tim Perdue) - -Vim is one of a select bunch of tools for which I have no substitute. It is -a brilliant piece of work! (Biju Chacko) - -A previous girlfriend of mine switched to emacs. Needless to say, the -relationship went nowhere. (Geoffrey Mann) - -I rarely think about Vim, in the same way that I guess a fish rarely thinks -about water. It's the environment in which everything else happens. I'm a -fairly busy system administrator working on a lot of different platforms. Vim -is the only thing that's consistent across all my systems, and it's just about -the only thing that doesn't break from time to time. When a new system comes -in the door without Vim, I install it right away. Great to have a tool that's -the same everywhere, that's completely reliable, so I can ignore it and think -about other things. (Pete Schaeffer) - -Having recently succeeded in running Vim via telnet through a Nokia -Communicator, I can now report that it works nicely on a Palm Pilot too. -(Allan Kelly, Scotland) - -You've done a tremendous job with 'VIM', Bram! The more I use it, the more -impressed I get (I am an old 'vi' die hard who once started out with early -versions of 'emacs' in the late 1970's and was relieved by finding 'vi' in the -first UNIX I came across in 1983). In my opinion, it's about time 'VIM' -replace 'emacs' as the standard for top editors. (Bo Thide', Sweden) - -I love and use VIM heavily too. (Larry Wall) - -Vi is like a Ferrari, if you're a beginner, it handles like a bitch, but once -you get the hang of it, it's small, powerful and FAST! (Unknown) -VIM is like a new model Ferrari, and sounds like one too - "VIIIIIIMMM!" -(Stephen Riehm, Germany) - -Schon bei Nutzung eines Bruchteils der VIM-Funktionen wird der Benutzer recht -schnell die Vorzuege dieses Editors kennen- und schaetzenlernen. -Translated: Even when only using a fraction of VIM-functions, the user will -quickly get used to and appreciate the advantages of this editor. (Garry -Glendown, conclusion of an article on VIM in iX magazine 9/1998) - -I've recently acquired the O'Reilly book on VI (it also discusses VIM -in-depth), and I'm amazed at just how powerful this application is. (Jeffrey -Rankin) - -This guide was written using the Windows 9.x distribution of GVIM, which is -quite possibly the greatest thing to come along since God created the naked -girl. (Michael DiBernardo) - -Boy, I thought I knew almost everything about VIM, but every time I browse the -online documentation, I hit upon a minor but cool aspect of a VIM feature that -I didn't know before! I must say the documentation is one the finest I've -ever seen in a product -- even better than most commercial products. -(Gautam Mudunuri) - -VIM 4.5 is really a fantastic editor. It has sooooo many features and more -importantly, the defaults are so well thought out that you really don't have -to change anything!! Words cannot express my amazement and gratitude to the -creators of VIM. Keep it up. (Vikas, USA) - -I wonder how long it will be before people will refer to other Vi editors as -VIM clones? (Darren Hiebert) - -I read about [auto-positioning-in-file-based-on-the-errors-from-make] in one -of those "Perfect Programmer's Editor" threads and was delighted to discover -that VIM already supports it. (Brendan Macmillan, Australia) - -I just discovered VIM (5.0) and I'm telling everyone I know about it! -I tell them VIM stands for VI for the new (M)illenium. Thanks so much! -(Matt F. Valentine) - -I think from now on "vi" should be called "Vim Imitation", not the other way -around. (Rungun Ramanathan) - -The Law of VIM: -For each member b of the possible behaviour space B of program P, there exists -a finite time t before which at least one user u in the total user space U of -program P will request b becomes a member of the allowed behaviour space B' -(B' <= B). -In other words: Sooner or later everyone wants everything as an option. -(Negri) - -Whenever I move to a new computing platform, the first thing I do is to port -VIM. Lately, I am simply stunned by its ease of compilation using the -configure facility. (A.M. Sabuncu, Turkey) - -The options are really excellent and very powerful. (Anish Maharaj) - -The Spring user-interface designs are in, and word from the boutiques is that -80x24 text-only mode is back with a *vengeance! Vi editor clone VIM burst onto -March desk-tops with a dazzling show of pastel syntax highlights for its 5.0 -look. Strident and customizable, VIM raises eyebrows with its interpretation -of the classic Vi single-key macro collection. -http://www.ntk.net/index.cgi?back=archive98/now0327.txt&line=179#l - -I just wanted to take this opportunity to let you know that VIM 5 ROCKS! -Syntax highlighting: how did I survive without it?! Thank you for creating -mankind's best editor! (Mun Johl, USA) - -Thanks again for VIM. I use it every day on Linux. (Eric Foster-Johnson, -author of the book "UNIX Programming Tools") - -The BEST EDITOR EVER (Stuart Woolford) - -I have used most of VIM's fancy features at least once, many frequently, and I -can honestly say that I couldn't live with anything less anymore. My -productivity has easily doubled compared to what it was when I used vi. -(Sitaram Chamarty) - -I luv VIM. It is incredible. I'm naming my first-born Vimberly. (Jose -Unpingco, USA) - -Hint: "VIM" is "vi improved" - much better! (Sven Guckes, Germany) - -I use VIM every day. I spend more time in VIM than in any other program... -It's the best vi clone there is. I think it's great. (Craig Sanders, -Australia) - -I strongly advise using VIM--its infinite undo/redo saved me much grief. -(Terry Brown) - -Thanks very much for writing what in my opinion is the finest text editor on -the planet. If I were to get another cat, I would name it "Vim". -(Bob Sheehan, USA) - -I typed :set all and the screen FILLED up with options. A whole screen of -things to be set and unset. I saw some of my old friends like wrapmargin, -modelines and showmode, but the screen was FILLED with new friends! I love -them all! I love VIM! I'm so happy that I've found this editor! I feel -like how I once felt when I started using vi after a couple of years of using -ed. I never thought I'd forsake my beloved ed, but vi ... oh god, vi was -great. And now, VIM. (Peter Jay Salzman, USA) - -I am really happy with such a wonderful software package. Much better than -almost any expensive, off the shelf program. (Jeff Walker) - -Whenever I reread the VIM documentation I'm overcome with excitement at the -power of the editor. (William Edward Webber, Australia) - -Hurrah for VIM!! It is "at your fingertips" like vi, and has the extensions -that vi sorely needs: highlighting for executing commands on blocks, an easily -navigable and digestible help screen, and more. (Paul Pax) - -The reason WHY I don't have this amazingly useful macro anymore, is that I -now use VIM - and this is built in!! (Stephen Riehm, Germany) - -I am a user of VIM and I love it. I use it to do all my programming, C, -C++, HTML what ever. (Tim Allwine) - -I discovered VIM after years of struggling with the original vi, and I just -can't live without it anymore. (Emmanuel Mogenet, USA) - -Emacs has not a bit of chance to survive so long as VIM is around. Besides, -it also has the most detailed software documentation I have ever seen---much -better than most commercial software! (Leiming Qian) - -This version of VIM will just blow people apart when they discover just how -fantastic it is! (Tony Nugent, Australia) - -I took your advice & finally got VIM & I'm really impressed. Instant convert. -(Patrick Killelea, USA) - -VIM is by far my favorite piece of shareware and I have been particularly -pleased with version 3.0. This is really a solid piece of work. (Robert -Colon, USA) - -VIM is a joy to use, it is so well thought and practical that I wonder why -anybody would use visual development tools. VIM is powerful and elegant, it -looks deceptively simple but is almost as complex as a 747 (especially when I -look at my growing vimrc), keep up that wonderful job, VIM is a centerpiece -of the free software world. (Louis-David Mitterand, USA) - -I cannot believe how great it is to use VIM. I think the guys at work are -getting tired of hearing me bragging about it. Others eyes are lighting up. -(Rick Croote) - -Emacs takes way too much time to start up and run, it is too big and bulky for -effective use and the interface is more confusing than it is of any help. VIM -however is short, it is fast, it is powerful, it has a good interface and it -is all purpose. (Paal Ditlefsen Ekran) - -From the first time I got VIM3.0, I was very enthusiastic. It has almost no -problems. The swapfile handling and the backup possibilities are robust, also -the protection against editing one file twice. It is very compatible to the -real VI (and that is a MUST, because my brain is trained over years in using -it). (Gert van Antwerpen, Holland) - -Visual mode in VIM is a very powerful thing! (Tony Nugent, Australia) - -I have to say that VIM is =THE= single greatest piece of source code to ever -come across the net (Jim Battle, USA). - -In fact, if you do want to get a new vi I'd suggest VIM-3.0. This is, by -far, the best version of vi I've ever seen (Albert W. Schueller). - -I should mention that VIM is a very good editor and can compete with anything -(Ilya Beloozerov). - -To tell the truth sometimes I used elvis, vile, xvi, calvin, etc. And this is -the reason that I can state that VIM is the best! (Ferenc Deak, Hungary) - -VIM is by far the best editor that I have used in a long time, and I have -looked at just about every thing that is available for every platform that I -use. VIM is the best on all of them. (Guy L. Oliver) - -VIM is the greatest editor since the stone chisel. (Jose Unpingco, USA) - -I would like to say that with VIM I am finally making the 'emacs to vi' -transition - as an Editor it is so much better in many ways: keyboard layout, -memory usage, text alteration to name 3. (Mark Adam) - -In fact, now if I want to know what a particular setting does in vi, I fire up -VIM and check out its help! (Nikhil Patel, USA) - -As a vi user, VIM has made working with text a far more pleasant task than -before I encountered this program. (Steinar Knutsen, Norway) - -I use VIM since version 3.0. Since that time, it is the ONLY editor I use, -with Solaris, Linux and OS/2 Warp. I suggest all my friends to use VIM, they -try, and they continue using it. VIM is really the best software I have ever -downloaded from the Internet, and the best editor I know of. (Marco -Eccettuato, Italy) - - -In summary: - __ ___ _ _ _ ___ _____ ` - \ \ / (_)_ __ ___ (_)___ | | | |/ _ \_ _| ` - \ \ / /| | '_ ` _ \ | / __| | |_| | | | || | ` - \ V / | | | | | | | | \__ \ | _ | |_| || | ` - \_/ |_|_| |_| |_| |_|___/ |_| |_|\___/ |_| ` - ____ _____ _ _ _____ _____ _ _ ` - / ___|_ _| | | | ___| ___| | | ` - \___ \ | | | | | | |_ | |_ | | | ` - ___) || | | |_| | _| | _| |_|_| ` - |____/ |_| \___/|_| |_| (_|_) (Tony Nugent, Australia) ` - - - vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/remote_plugin.txt b/runtime/doc/remote_plugin.txt index 139fcd83b9..dddc021d68 100644 --- a/runtime/doc/remote_plugin.txt +++ b/runtime/doc/remote_plugin.txt @@ -16,8 +16,8 @@ Nvim support for remote plugins *remote-plugin* Extensibility is a primary goal of Nvim. Any programming language may be used to extend Nvim without changes to Nvim itself. This is achieved with remote -plugins, coprocesses that have a direct communication channel (via -|msgpack-rpc|) with the Nvim process. +plugins, coprocesses that have a direct communication channel (via |RPC|) with +the Nvim process. Even though these plugins run in separate processes they can call, be called, and receive events just as if the plugin's code were executed in the main @@ -33,9 +33,9 @@ check whether a plugin host is available for their chosen programming language. Plugin hosts are programs that provide a high-level environment for plugins, taking care of most boilerplate involved in defining commands, autocmds, and -functions that are implemented over |msgpack-rpc| connections. Hosts are -loaded only when one of their registered plugins require it, keeping Nvim's -startup as fast as possible, even if many plugins/hosts are installed. +functions that are implemented over |RPC| connections. Hosts are loaded only +when one of their registered plugins require it, keeping Nvim's startup as +fast as possible, even if many plugins/hosts are installed. ============================================================================== 3. Example *remote-plugin-example* @@ -93,22 +93,22 @@ approach with |rpcnotify()|, meaning return values or exceptions raised in the handler function are ignored. To test the above plugin, it must be saved in "rplugin/python" in a -'runtimepath' directory (~/.config/nvim/rplugin/python/limit.py for example). -Then, the remote plugin manifest must be generated with -`:UpdateRemotePlugins`. +'runtimepath' directory (~/.config/nvim/rplugin/python/limit.py for example). +Then, the remote plugin manifest must be generated with +|:UpdateRemotePlugins|. ============================================================================== 4. Remote plugin manifest *remote-plugin-manifest* + *:UpdateRemotePlugins* Just installing remote plugins to "rplugin/{host}" isn't enough for them to be -automatically loaded when required. You must execute `:UpdateRemotePlugins` +automatically loaded when required. You must execute |:UpdateRemotePlugins| every time a remote plugin is installed, updated, or deleted. -`:UpdateRemotePlugins` generates the remote plugin manifest, a special +|:UpdateRemotePlugins| generates the remote plugin manifest, a special Vimscript file containing declarations for all Vimscript entities (commands/autocommands/functions) defined by all remote plugins, with each -entity associated with the host and plugin path. The manifest is a generated -extension to the user's vimrc (it even has the vimrc filename prepended). +entity associated with the host and plugin path. Manifest declarations are just calls to the `remote#host#RegisterPlugin` function, which takes care of bootstrapping the host as soon as the declared @@ -125,10 +125,20 @@ the example, say the Java plugin is a semantic completion engine for Java code. If it defines the autocommand "BufEnter *.java", then the Java host is spawned only when Nvim loads a buffer matching "*.java". -If the explicit call to `:UpdateRemotePlugins` seems incovenient, try to see it +If the explicit call to |:UpdateRemotePlugins| seems incovenient, try to see it like this: It's a way to provide IDE capabilities in Nvim while still keeping it fast and lightweight for general use. It's also analogous to the |:helptags| command. + *$NVIM_RPLUGIN_MANIFEST* +Unless $NVIM_RPLUGIN_MANIFEST is set the manifest will be written to a file +named `rplugin.vim` at: + + Unix ~ + $XDG_DATA_HOME/nvim/ or ~/.local/share/nvim/ + + Windows ~ + $LOCALAPPDATA/nvim/ or ~/AppData/Local/nvim/ + ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 343d3e62cf..ef98556260 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2016 Jan 16 +*repeat.txt* For Vim version 7.4. Last change: 2016 Jul 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -8,12 +8,14 @@ Repeating commands, Vim scripts and debugging *repeating* Chapter 26 of the user manual introduces repeating |usr_26.txt|. -1. Single repeats |single-repeat| -2. Multiple repeats |multi-repeat| -3. Complex repeats |complex-repeat| -4. Using Vim scripts |using-scripts| -5. Debugging scripts |debug-scripts| -6. Profiling |profiling| +1. Single repeats |single-repeat| +2. Multiple repeats |multi-repeat| +3. Complex repeats |complex-repeat| +4. Using Vim scripts |using-scripts| +5. Using Vim packages |packages| +6. Creating Vim packages |package-create| +7. Debugging scripts |debug-scripts| +8. Profiling |profiling| ============================================================================== 1. Single repeats *single-repeat* @@ -68,8 +70,8 @@ examples. The global commands work by first scanning through the [range] lines and marking each line where a match occurs (for a multi-line pattern, only the start of the match matters). -In a second scan the [cmd] is executed for each marked line with its line -number prepended. For ":v" and ":g!" the command is executed for each not +In a second scan the [cmd] is executed for each marked line, as if the cursor +was in that line. For ":v" and ":g!" the command is executed for each not marked line. If a line is deleted its mark disappears. The default for [range] is the whole buffer (1,$). Use "CTRL-C" to interrupt the command. If an error message is given for a line, the command for that @@ -173,10 +175,12 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. commands. *:ru* *:runtime* -:ru[ntime][!] {file} .. +:ru[ntime][!] [where] {file} .. Read Ex commands from {file} in each directory given - by 'runtimepath'. There is no error for non-existing - files. Example: > + by 'runtimepath' and/or 'packpath'. There is no error + for non-existing files. + + Example: > :runtime syntax/c.vim < There can be multiple {file} arguments, separated by @@ -190,6 +194,15 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. When it is not included only the first found file is sourced. + When [where] is omitted only 'runtimepath' is used. + Other values: + START search under "start" in 'packpath' + OPT search under "opt" in 'packpath' + PACK search under "start" and "opt" in + 'packpath' + ALL first use 'runtimepath', then search + under "start" and "opt" in 'packpath' + When {file} contains wildcards it is expanded to all matching files. Example: > :runtime! plugin/*.vim @@ -203,6 +216,59 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. When 'verbose' is two or higher, there is a message about each searched file. + *:pa* *:packadd* *E919* +:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath' + and source any plugin files found. The directory must + match: + pack/*/opt/{name} ~ + The directory is added to 'runtimepath' if it wasn't + there yet. + If the directory pack/*/opt/{name}/after exists it is + added at the end of 'runtimepath'. + + Note that {name} is the directory name, not the name + of the .vim file. All the files matching the pattern + pack/*/opt/{name}/plugin/**/*.vim ~ + will be sourced. This allows for using subdirectories + below "plugin", just like with plugins in + 'runtimepath'. + + If the filetype detection was not enabled yet (this + is usually done with a "syntax enable" or "filetype + on" command in your .vimrc file), this will also look + for "{name}/ftdetect/*.vim" files. + + When the optional ! is added no plugin files or + ftdetect scripts are loaded, only the matching + directories are added to 'runtimepath'. This is + useful in your .vimrc. The plugins will then be + loaded during initialization, see |load-plugins|. + + Also see |pack-add|. + + *:packl* *:packloadall* +:packl[oadall][!] Load all packages in the "start" directory under each + entry in 'packpath'. + + First all the directories found are added to + 'runtimepath', then the plugins found in the + directories are sourced. This allows for a plugin to + depend on something of another plugin, e.g. an + "autoload" directory. See |packload-two-steps| for + how this can be useful. + + This is normally done automatically during startup, + after loading your .vimrc file. With this command it + can be done earlier. + + Packages will be loaded only once. After this command + it won't happen again. When the optional ! is added + this command will load packages even when done before. + + An error only causes sourcing the script where it + happens to be aborted, further plugins will be loaded. + See |packages|. + :scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167* Specify the character encoding used in the script. The following lines will be converted from [encoding] @@ -220,7 +286,9 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. ... not converted ... < When conversion isn't supported by the system, there - is no error message and no conversion is done. + is no error message and no conversion is done. When a + line can't be converted there is no error and the + original line is kept. Don't use "ucs-2" or "ucs-4", scripts cannot be in these encodings (they would contain NUL bytes). @@ -373,7 +441,189 @@ Rationale: < Therefore the unusual leading backslash is used. ============================================================================== -5. Debugging scripts *debug-scripts* +5. Using Vim packages *packages* + +A Vim package is a directory that contains one or more plugins. The +advantages over normal plugins: +- A package can be downloaded as an archive and unpacked in its own directory. + Thus the files are not mixed with files of other plugins. That makes it + easy to update and remove. +- A package can be a git, mercurial, etc. repository. That makes it really + easy to update. +- A package can contain multiple plugins that depend on each other. +- A package can contain plugins that are automatically loaded on startup and + ones that are only loaded when needed with `:packadd`. + + +Using a package and loading automatically ~ + +Let's assume your Vim files are in the "~/.local/share/nvim/site" directory +and you want to add a package from a zip archive "/tmp/foopack.zip": + % mkdir -p ~/.local/share/nvim/site/pack/foo + % cd ~/.local/share/nvim/site/pack/foo + % unzip /tmp/foopack.zip + +The directory name "foo" is arbitrary, you can pick anything you like. + +You would now have these files under ~/.local/share/nvim/site: + pack/foo/README.txt + pack/foo/start/foobar/plugin/foo.vim + pack/foo/start/foobar/syntax/some.vim + pack/foo/opt/foodebug/plugin/debugger.vim + +When Vim starts up, after processing your .vimrc, it scans all directories in +'packpath' for plugins under the "pack/*/start" directory. First all those +directories are added to 'runtimepath'. Then all the plugins are loaded. +See |packload-two-steps| for how these two steps can be useful. + +In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and adds +"~/.local/share/nvim/site/pack/foo/start/foobar" to 'runtimepath'. + +If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will +find the syntax/some.vim file, because its directory is in 'runtimepath'. + +Vim will also load ftdetect files, if there are any. + +Note that the files under "pack/foo/opt" are not loaded automatically, only the +ones under "pack/foo/start". See |pack-add| below for how the "opt" directory +is used. + +Loading packages automatically will not happen if loading plugins is disabled, +see |load-plugins|. + +To load packages earlier, so that 'runtimepath' gets updated: > + :packloadall +This also works when loading plugins is disabled. The automatic loading will +only happen once. + +If the package has an "after" directory, that directory is added to the end of +'runtimepath', so that anything there will be loaded later. + + +Using a single plugin and loading it automatically ~ + +If you don't have a package but a single plugin, you need to create the extra +directory level: + % mkdir -p ~/.local/share/nvim/site/pack/foo/start/foobar + % cd ~/.local/share/nvim/site/pack/foo/start/foobar + % unzip /tmp/someplugin.zip + +You would now have these files: + pack/foo/start/foobar/plugin/foo.vim + pack/foo/start/foobar/syntax/some.vim + +From here it works like above. + + +Optional plugins ~ + *pack-add* +To load an optional plugin from a pack use the `:packadd` command: > + :packadd foodebug +This searches for "pack/*/opt/foodebug" in 'packpath' and will find +~/.local/share/nvim/site/pack/foo/opt/foodebug/plugin/debugger.vim and source +it. + +This could be done if some conditions are met. For example, depending on +whether Vim supports a feature or a dependency is missing. + +You can also load an optional plugin at startup, by putting this command in +your |.vimrc|: > + :packadd! foodebug +The extra "!" is so that the plugin isn't loaded if Vim was started with +|--noplugin|. + +It is perfectly normal for a package to only have files in the "opt" +directory. You then need to load each plugin when you want to use it. + + +Where to put what ~ + +Since color schemes, loaded with `:colorscheme`, are found below +"pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend +you put them below "pack/*/opt", for example +".vim/pack/mycolors/opt/dark/colors/very_dark.vim". + +Filetype plugins should go under "pack/*/start", so that they are always +found. Unless you have more than one plugin for a file type and want to +select which one to load with `:packadd`. E.g. depending on the compiler +version: > + if foo_compiler_version > 34 + packadd foo_new + else + packadd foo_old + endif + +The "after" directory is most likely not useful in a package. It's not +disallowed though. + +============================================================================== +6. Creating Vim packages *package-create* + +This assumes you write one or more plugins that you distribute as a package. + +If you have two unrelated plugins you would use two packages, so that Vim +users can chose what they include or not. Or you can decide to use one +package with optional plugins, and tell the user to add the ones he wants with +`:packadd`. + +Decide how you want to distribute the package. You can create an archive or +you could use a repository. An archive can be used by more users, but is a +bit harder to update to a new version. A repository can usually be kept +up-to-date easily, but it requires a program like "git" to be available. +You can do both, github can automatically create an archive for a release. + +Your directory layout would be like this: + start/foobar/plugin/foo.vim " always loaded, defines commands + start/foobar/plugin/bar.vim " always loaded, defines commands + start/foobar/autoload/foo.vim " loaded when foo command used + start/foobar/doc/foo.txt " help for foo.vim + start/foobar/doc/tags " help tags + opt/fooextra/plugin/extra.vim " optional plugin, defines commands + opt/fooextra/autoload/extra.vim " loaded when extra command used + opt/fooextra/doc/extra.txt " help for extra.vim + opt/fooextra/doc/tags " help tags + +This allows for the user to do: > + mkdir ~/.local/share/nvim/site/pack/myfoobar + cd ~/.local/share/nvim/site/pack/myfoobar + git clone https://github.com/you/foobar.git + +Here "myfoobar" is a name that the user can choose, the only condition is that +it differs from other packages. + +In your documentation you explain what the plugins do, and tell the user how +to load the optional plugin: > + :packadd! fooextra + +You could add this packadd command in one of your plugins, to be executed when +the optional plugin is needed. + +Run the `:helptags` command to generate the doc/tags file. Including this +generated file in the package means that the user can drop the package in his +pack directory and the help command works right away. Don't forget to re-run +the command after changing the plugin help: > + :helptags path/start/foobar/doc + :helptags path/opt/fooextra/doc + + +Dependencies between plugins ~ + *packload-two-steps* +Suppose you have two plugins that depend on the same functionality. You can +put the common functionality in an autoload directory, so that it will be +found automatically. Your package would have these files: + + pack/foo/start/one/plugin/one.vim > + call foolib#getit() +< pack/foo/start/two/plugin/two.vim > + call foolib#getit() +< pack/foo/start/lib/autoload/foolib.vim > + func foolib#getit() + +This works, because loading packages will first add all found directories to +'runtimepath' before sourcing the plugins. + +============================================================================== +7. Debugging scripts *debug-scripts* Besides the obvious messages that you can add to your scripts to find out what they are doing, Vim offers a debug mode. This allows you to step through a @@ -484,7 +734,7 @@ Additionally, these commands can be used: About the additional commands in debug mode: - There is no command-line completion for them, you get the completion for the normal Ex commands only. -- You can shorten them, up to a single character, unless more then one command +- You can shorten them, up to a single character, unless more than one command starts with the same letter. "f" stands for "finish", use "fr" for "frame". - Hitting <CR> will repeat the previous one. When doing another command, this is reset (because it's not clear what you want to repeat). @@ -597,7 +847,7 @@ OBSCURE user, don't use typeahead for debug commands. ============================================================================== -6. Profiling *profile* *profiling* +8. Profiling *profile* *profiling* Profiling means that Vim measures the time that is spent on executing functions and/or scripts. The |+profile| feature is required for this. diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 44a5361c5d..fd1fe8dce3 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -1,4 +1,4 @@ -*sign.txt* For Vim version 7.4. Last change: 2014 May 07 +*sign.txt* For Vim version 7.4. Last change: 2016 Aug 12 VIM REFERENCE MANUAL by Gordon Prieur @@ -40,8 +40,10 @@ There are two steps in using signs: When signs are defined for a file, Vim will automatically add a column of two characters to display them in. When the last sign is unplaced the column -disappears again. The color of the column is set with the SignColumn group -|hl-SignColumn|. Example to set the color: > +disappears again. This behavior can be changed with the 'signcolumn' option. + +The color of the column is set with the SignColumn group |hl-SignColumn|. +Example to set the color: > :highlight SignColumn guibg=darkgrey diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 752444a3bd..0902d5d10f 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.4. Last change: 2014 Sep 19 +*spell.txt* VIM REFERENCE MANUAL by Bram Moolenaar @@ -11,10 +11,6 @@ Spell checking *spell* 3. Generating a spell file |spell-mkspell| 4. Spell file format |spell-file-format| -Note: There also is a vimspell plugin. If you have it you can do ":help -vimspell" to find about it. But you will probably want to get rid of the -plugin and use the 'spell' option instead, it works better. - ============================================================================== 1. Quick start *spell-quickstart* *E756* @@ -1373,6 +1369,14 @@ the item name. Case is always ignored. The Hunspell feature to use three arguments and flags is not supported. + *spell-NOCOMPOUNDSUGS* +This item indicates that using compounding to make suggestions is not a good +idea. Use this when compounding is used with very short or one-character +words. E.g. to make numbers out of digits. Without this flag creating +suggestions would spend most time trying all kind of weird compound words. + + NOCOMPOUNDSUGS ~ + *spell-SYLLABLE* The SYLLABLE item defines characters or character sequences that are used to count the number of syllables in a word. Example: @@ -1625,4 +1629,111 @@ WORDCHARS (Hunspell) *spell-WORDCHARS* is no need to separate words before checking them (using a trie instead of a hashtable). +============================================================================== +5. Spell checker design *develop-spell* + +When spell checking was going to be added to Vim a survey was done over the +available spell checking libraries and programs. Unfortunately, the result +was that none of them provided sufficient capabilities to be used as the spell +checking engine in Vim, for various reasons: + +- Missing support for multi-byte encodings. At least UTF-8 must be supported, + so that more than one language can be used in the same file. + Doing on-the-fly conversion is not always possible (would require iconv + support). +- For the programs and libraries: Using them as-is would require installing + them separately from Vim. That's mostly not impossible, but a drawback. +- Performance: A few tests showed that it's possible to check spelling on the + fly (while redrawing), just like syntax highlighting. But the mechanisms + used by other code are much slower. Myspell uses a hashtable, for example. + The affix compression that most spell checkers use makes it slower too. +- For using an external program like aspell a communication mechanism would + have to be setup. That's complicated to do in a portable way (Unix-only + would be relatively simple, but that's not good enough). And performance + will become a problem (lots of process switching involved). +- Missing support for words with non-word characters, such as "Etten-Leur" and + "et al.", would require marking the pieces of them OK, lowering the + reliability. +- Missing support for regions or dialects. Makes it difficult to accept + all English words and highlight non-Canadian words differently. +- Missing support for rare words. Many words are correct but hardly ever used + and could be a misspelled often-used word. +- For making suggestions the speed is less important and requiring to install + another program or library would be acceptable. But the word lists probably + differ, the suggestions may be wrong words. + + +Spelling suggestions *develop-spell-suggestions* + +For making suggestions there are two basic mechanisms: +1. Try changing the bad word a little bit and check for a match with a good + word. Or go through the list of good words, change them a little bit and + check for a match with the bad word. The changes are deleting a character, + inserting a character, swapping two characters, etc. +2. Perform soundfolding on both the bad word and the good words and then find + matches, possibly with a few changes like with the first mechanism. + +The first is good for finding typing mistakes. After experimenting with +hashtables and looking at solutions from other spell checkers the conclusion +was that a trie (a kind of tree structure) is ideal for this. Both for +reducing memory use and being able to try sensible changes. For example, when +inserting a character only characters that lead to good words need to be +tried. Other mechanisms (with hashtables) need to try all possible letters at +every position in the word. Also, a hashtable has the requirement that word +boundaries are identified separately, while a trie does not require this. +That makes the mechanism a lot simpler. + +Soundfolding is useful when someone knows how the words sounds but doesn't +know how it is spelled. For example, the word "dictionary" might be written +as "daktonerie". The number of changes that the first method would need to +try is very big, it's hard to find the good word that way. After soundfolding +the words become "tktnr" and "tkxnry", these differ by only two letters. + +To find words by their soundfolded equivalent (soundalike word) we need a list +of all soundfolded words. A few experiments have been done to find out what +the best method is. Alternatives: +1. Do the sound folding on the fly when looking for suggestions. This means + walking through the trie of good words, soundfolding each word and + checking how different it is from the bad word. This is very efficient for + memory use, but takes a long time. On a fast PC it takes a couple of + seconds for English, which can be acceptable for interactive use. But for + some languages it takes more than ten seconds (e.g., German, Catalan), + which is unacceptable slow. For batch processing (automatic corrections) + it's too slow for all languages. +2. Use a trie for the soundfolded words, so that searching can be done just + like how it works without soundfolding. This requires remembering a list + of good words for each soundfolded word. This makes finding matches very + fast but requires quite a lot of memory, in the order of 1 to 10 Mbyte. + For some languages more than the original word list. +3. Like the second alternative, but reduce the amount of memory by using affix + compression and store only the soundfolded basic word. This is what Aspell + does. Disadvantage is that affixes need to be stripped from the bad word + before soundfolding it, which means that mistakes at the start and/or end + of the word will cause the mechanism to fail. Also, this becomes slow when + the bad word is quite different from the good word. + +The choice made is to use the second mechanism and use a separate file. This +way a user with sufficient memory can get very good suggestions while a user +who is short of memory or just wants the spell checking and no suggestions +doesn't use so much memory. + + +Word frequency + +For sorting suggestions it helps to know which words are common. In theory we +could store a word frequency with the word in the dictionary. However, this +requires storing a count per word. That degrades word tree compression a lot. +And maintaining the word frequency for all languages will be a heavy task. +Also, it would be nice to prefer words that are already in the text. This way +the words that appear in the specific text are preferred for suggestions. + +What has been implemented is to count words that have been seen during +displaying. A hashtable is used to quickly find the word count. The count is +initialized from words listed in COMMON items in the affix file, so that it +also works when starting a new file. + +This isn't ideal, because the longer Vim is running the higher the counts +become. But in practice it is a noticeable improvement over not using the word +count. + vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 46efe1996a..9284aaea58 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 7.4. Last change: 2015 Jan 15 +*starting.txt* For Vim version 7.4. Last change: 2016 Jul 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -10,9 +10,11 @@ Starting Vim *starting* 2. Initialization |initialization| 3. $VIM and $VIMRUNTIME |$VIM| 4. Suspending |suspend| -5. Saving settings |save-settings| -6. Views and Sessions |views-sessions| -7. The ShaDa file |shada-file| +5. Exiting |exiting| +6. Saving settings |save-settings| +7. Views and Sessions |views-sessions| +8. The ShaDa file |shada-file| +9. Base Directories |base-directories| ============================================================================== 1. Vim arguments *vim-arguments* @@ -40,6 +42,7 @@ filename One or more file names. The first one will be the current nvim -- -filename < All arguments after the "--" will be interpreted as file names, no other options or "+command" argument can follow. + For behavior of quotes on MS-Windows, see |win32-quotes|. *--* - This argument can mean two things, depending on whether Ex @@ -195,7 +198,8 @@ argument. -Z Restricted mode. All commands that make use of an external shell are disabled. This includes suspending with CTRL-Z, ":sh", filtering, the system() function, backtick expansion, - delete(), rename(), mkdir(), writefile(), libcall(), etc. + delete(), rename(), mkdir(), writefile(), libcall(), + jobstart(), etc. *-e* -e Start Vim in Ex mode |Q|. @@ -349,6 +353,9 @@ argument. *-W* -W {scriptout} Like -w, but do not append, overwrite an existing file. + *--api-info* +--api-info Print msgpack-encoded |api-metadata| and exit. + ============================================================================== 2. Initialization *initialization* *startup* @@ -377,7 +384,7 @@ accordingly. Vim proceeds in this order: name, "init.vim" is Neovim specific location for vimrc file. Also see |vimrc-intro|. - Places for your personal initializations: + Places for your personal initializations (see |base-directories|): Unix $XDG_CONFIG_HOME/nvim/init.vim (default for $XDG_CONFIG_HOME is ~/.config) Windows $XDG_CONFIG_HOME/nvim/init.vim @@ -459,6 +466,11 @@ accordingly. Vim proceeds in this order: commands from the command line have not been executed yet. You can use "--cmd 'set noloadplugins'" |--cmd|. + Packages are loaded. These are plugins, as above, but found in the + "start" directory of each entry in 'packpath'. Every plugin directory + found is added in 'runtimepath' and then the plugins are sourced. See + |packages|. + 7. Set 'shellpipe' and 'shellredir' The 'shellpipe' and 'shellredir' options are set according to the value of the 'shell' option, unless they have been set before. @@ -494,8 +506,9 @@ accordingly. Vim proceeds in this order: 14. Execute startup commands If a "-t" flag was given to Vim, the tag is jumped to. The commands given with the |-c| and |+cmd| arguments are executed. - The starting flag is reset, has("vim_starting") will now return zero. If the 'insertmode' option is set, Insert mode is entered. + The starting flag is reset, has("vim_starting") will now return zero. + The |v:vim_did_enter| variable is set to 1. The |VimEnter| autocommands are executed. Some hints on using initializations: @@ -696,7 +709,20 @@ can't paste it in another application (since Vim is going to sleep an attempt to get the selection would make the program hang). ============================================================================== -5. Saving settings *save-settings* +5. Exiting *exiting* + +There are several ways to exit Vim: +- Close the last window with `:quit`. Only when there are no changes. +- Close the last window with `:quit!`. Also when there are changes. +- Close all windows with `:qall`. Only when there are no changes. +- Close all windows with `:qall!`. Also when there are changes. +- Use `:cquit`. Also when there are changes. + +When using `:cquit` or when there was an error message Vim exits with exit +code 1. Errors can be avoided by using `:silent!`. + +============================================================================== +6. Saving settings *save-settings* Mostly you will edit your vimrc files manually. This gives you the greatest flexibility. There are a few commands to generate a vimrc file automatically. @@ -753,7 +779,7 @@ these steps: You need to escape special characters, esp. spaces. ============================================================================== -6. Views and Sessions *views-sessions* +7. Views and Sessions *views-sessions* This is introduced in sections |21.4| and |21.5| of the user manual. @@ -897,7 +923,7 @@ To automatically save and restore views for *.c files: > au BufWinEnter *.c silent loadview ============================================================================== -7. The ShaDa file *shada* *shada-file* +8. The ShaDa file *shada* *shada-file* If you exit Vim and later start it again, you would normally lose a lot of information. The ShaDa file can be used to remember that information, which @@ -1059,7 +1085,7 @@ even if other entries (with known name/type/etc) are merged. |shada-merging| SHADA FILE NAME *shada-file-name* - The default name of the ShaDa file is "$XDG_DATA_HOME/nvim/shada/main.shada" - for Unix. Default for $XDG_DATA_HOME is ~/.local/share. + for Unix. Default for $XDG_DATA_HOME is ~/.local/share. |base-directories| - The 'n' flag in the 'shada' option can be used to specify another ShaDa file name |'shada'|. - The "-i" Vim argument can be used to set another file name, |-i|. When the @@ -1109,7 +1135,7 @@ files for different types of files (e.g., C code) and load them based on the file name, using the ":autocmd" command (see |:autocmd|). More information on ShaDa file format is contained in |shada-format| section. - *E136* *E138* *shada-error-handling* + *E136* *E929* *shada-error-handling* Some errors make Neovim leave temporary file named `{basename}.tmp.X` (X is any free letter from `a` to `z`) while normally it will create this file, write to it and then rename `{basename}.tmp.X` to `{basename}`. Such errors @@ -1129,7 +1155,7 @@ include: Do not forget to remove the temporary file or replace the target file with temporary one after getting one of the above errors or all attempts to create -a ShaDa file may fail with |E138|. If you got one of them when using +a ShaDa file may fail with |E929|. If you got one of them when using |:wshada| (and not when exiting Neovim: i.e. when you have Neovim session running) you have additional options: @@ -1153,9 +1179,6 @@ running) you have additional options: already set (registers, marks, |v:oldfiles|, etc.) will be overwritten. - *:rv* *:rviminfo* -:rv[iminfo][!] [file] Deprecated alias to |:rshada| command. - *:wsh* *:wshada* *E137* :wsh[ada][!] [file] Write to ShaDa file [file] (default: see above). The information in the file is first read in to make @@ -1164,22 +1187,18 @@ running) you have additional options: internal info is written (also disables safety checks described in |shada-error-handling|). If 'shada' is empty, marks for up to 100 files will be written. - When you get error "E138: All .tmp.X files exist, + When you get error "E929: All .tmp.X files exist, cannot write ShaDa file!" check that no old temp files were left behind (e.g. ~/.local/share/nvim/shada/main.shada.tmp*). Note: Executing :wshada will reset all |'quote| marks. - *:wv* *:wviminfo* -:wv[iminfo][!] [file] Deprecated alias to |:wshada| command. - *:o* *:ol* *:oldfiles* -:o[ldfiles][!] List the files that have marks stored in the ShaDa +:o[ldfiles] List the files that have marks stored in the ShaDa file. This list is read on startup and only changes afterwards with ":rshada!". Also see |v:oldfiles|. The number can be used with |c_#<|. - Use ! to get a file selection prompt. :bro[wse] o[ldfiles][!] List file names as with |:oldfiles|, and then prompt @@ -1346,4 +1365,40 @@ file when reading and include: either contains more then one MessagePack object or it does not contain complete MessagePack object. +============================================================================== +9. Base Directories *base-directories* *xdg* + +Nvim conforms to the XDG Base Directory Specification for application +configuration and data file locations. This just means Nvim looks for some +optional settings and uses them if they exist, otherwise defaults are chosen. +https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + +CONFIGURATION DIRECTORY *$XDG_CONFIG_HOME* + + Base directory default: + Unix: ~/.config + Windows: ~/AppData/Local + + Nvim directory: + Unix: ~/.config/nvim/ + Windows: ~/AppData/Local/nvim/ + +DATA DIRECTORY *$XDG_DATA_HOME* + + Base directory default: + Unix: ~/.local/share + Windows: ~/AppData/Local + + Nvim directory: + Unix: ~/.local/share/nvim/ + Windows: ~/AppData/Local/nvim-data/ + +Note on Windows the configuration and data directory defaults are the same +(for lack of an alternative), but the sub-directory for data is named +"nvim-data" to separate it from the configuration sub-directory "nvim". + +Throughout other sections of the user manual, the defaults are used as generic +placeholders, e.g. where "~/.config" is mentioned it should be understood to +mean "$XDG_CONFIG_HOME or ~/.config". + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 81ba639dbe..e59f567826 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2015 Dec 19 +*syntax.txt* For Vim version 7.4. Last change: 2016 Aug 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -936,26 +936,29 @@ To disable them use ":unlet". Example: > :unlet c_comment_strings Variable Highlight ~ -c_gnu GNU gcc specific items -c_comment_strings strings and numbers inside a comment -c_space_errors trailing white space and spaces before a <Tab> -c_no_trail_space_error ... but no trailing spaces -c_no_tab_space_error ... but no spaces before a <Tab> -c_no_bracket_error don't highlight {}; inside [] as errors -c_no_curly_error don't highlight {}; inside [] and () as errors; +*c_gnu* GNU gcc specific items +*c_comment_strings* strings and numbers inside a comment +*c_space_errors* trailing white space and spaces before a <Tab> +*c_no_trail_space_error* ... but no trailing spaces +*c_no_tab_space_error* ... but no spaces before a <Tab> +*c_no_bracket_error* don't highlight {}; inside [] as errors +*c_no_curly_error* don't highlight {}; inside [] and () as errors; except { and } in first column -c_curly_error highlight a missing }; this forces syncing from the + Default is to highlight them, otherwise you + can't spot a missing ")". +*c_curly_error* highlight a missing }; this forces syncing from the start of the file, can be slow -c_no_ansi don't do standard ANSI types and constants -c_ansi_typedefs ... but do standard ANSI types -c_ansi_constants ... but do standard ANSI constants -c_no_utf don't highlight \u and \U in strings -c_syntax_for_h for *.h files use C syntax instead of C++ and use objc +*c_no_ansi* don't do standard ANSI types and constants +*c_ansi_typedefs* ... but do standard ANSI types +*c_ansi_constants* ... but do standard ANSI constants +*c_no_utf* don't highlight \u and \U in strings +*c_syntax_for_h* for *.h files use C syntax instead of C++ and use objc syntax instead of objcpp -c_no_if0 don't highlight "#if 0" blocks as comments -c_no_cformat don't highlight %-formats in strings -c_no_c99 don't highlight C99 standard items -c_no_c11 don't highlight C11 standard items +*c_no_if0* don't highlight "#if 0" blocks as comments +*c_no_cformat* don't highlight %-formats in strings +*c_no_c99* don't highlight C99 standard items +*c_no_c11* don't highlight C11 standard items +*c_no_bsd* don't highlight BSD specific types When 'foldmethod' is set to "syntax" then /* */ comments and { } blocks will become a fold. If you don't want comments to become a fold use: > @@ -1037,6 +1040,21 @@ This works immediately. CLOJURE *ft-clojure-syntax* +The default syntax groups can be augmented through the +*g:clojure_syntax_keywords* and *b:clojure_syntax_keywords* variables. The +value should be a |Dictionary| of syntax group names to a |List| of custom +identifiers: +> + let g:clojure_syntax_keywords = { + \ 'clojureMacro': ["defproject", "defcustom"], + \ 'clojureFunc': ["string/join", "string/replace"] + \ } +< +Refer to the Clojure syntax script for valid syntax group names. + +If the |buffer-variable| *b:clojure_syntax_without_core_keywords* is set, only +language constants and special forms are matched. + Setting *g:clojure_fold* enables folding Clojure code via the syntax engine. Any list, vector, or map that extends over more than one line can be folded using the standard Vim |fold-commands|. @@ -1569,15 +1587,6 @@ as Fvwm2 configuration files, add the following: > :au! BufNewFile,BufRead /etc/X11/fvwm2/* let b:fvwm_version = 2 | \ set filetype=fvwm -If you'd like Vim to highlight all valid color names, tell it where to -find the color database (rgb.txt) on your system. Do this by setting -"rgb_file" to its location. Assuming your color database is located -in /usr/X11/lib/X11/, you should add the line > - - :let rgb_file = "/usr/X11/lib/X11/rgb.txt" - -to your vimrc file. - GSP *gsp.vim* *ft-gsp-syntax* @@ -2886,7 +2895,7 @@ You may wish to embed languages into sh. I'll give an example courtesy of Lorance Stinson on how to do this with awk as an example. Put the following file into $HOME/.config/nvim/after/syntax/sh/awkembed.vim: > - " AWK Embedding: {{{1 + " AWK Embedding: " ============== " Shamelessly ripped from aspperl.vim by Aaron Hope. if exists("b:current_syntax") @@ -3345,6 +3354,13 @@ Note that schemas are not actually limited to plain scalars, but this is the only difference between schemas defined in YAML specification and the only difference defined in the syntax file. + +ZSH *zsh.vim* *ft-zsh-syntax* + +The syntax script for zsh allows for syntax-based folding: > + + :let g:zsh_fold_enable = 1 + ============================================================================== 5. Defining a syntax *:syn-define* *E410* @@ -3422,6 +3438,32 @@ SPELL CHECKING *:syn-spell* To activate spell checking the 'spell' option must be set. +SYNTAX ISKEYWORD SETTING *:syn-iskeyword* + +:sy[ntax] iskeyword [clear | {option}] + This defines the keyword characters. It's like the 'iskeyword' option + for but only applies to syntax highlighting. + + clear: Syntax specific iskeyword setting is disabled and the + buffer-local 'iskeyword' setting is used. + {option} Set the syntax 'iskeyword' option to a new value. + + Example: > + :syntax iskeyword @,48-57,192-255,$,_ +< + This would set the syntax specific iskeyword option to include all + alphabetic characters, plus the numeric characters, all accented + characters and also includes the "_" and the "$". + + If no argument is given, the current value will be output. + + Setting this option influences what |/\k| matches in syntax patterns + and also determines where |:syn-keyword| will be checked for a new + match. + + It is recommended when writing syntax files, to use this command + to the correct value for the specific syntax language and not change + the 'iskeyword' option. DEFINING KEYWORDS *:syn-keyword* @@ -3453,6 +3495,7 @@ DEFINING KEYWORDS *:syn-keyword* isn't, the keyword will never be recognized. Multi-byte characters can also be used. These do not have to be in 'iskeyword'. + See |:syn-iskeyword| for defining syntax specific iskeyword settings. A keyword always has higher priority than a match or region, the keyword is used if more than one item matches. Keywords do not nest @@ -4484,9 +4527,9 @@ in their own color. :colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath' for the file "colors/{name}.vim". The first one that is found is loaded. - To see the name of the currently active color scheme: > - :colo -< The name is also stored in the g:colors_name variable. + Also searches all plugins in 'packpath', first below + "start" and then under "opt". + Doesn't work recursively, thus you can't use ":colorscheme" in a color scheme script. After the color scheme has been loaded the @@ -4727,6 +4770,10 @@ font={font-name} *highlight-font* All fonts used, except for Menu and Tooltip, should be of the same character size as the default font! Otherwise redrawing problems will occur. + To use a font name with an embedded space or other special character, + put it in single quotes. The single quote cannot be used then. + Example: > + :hi comment font='Monospace 10' guifg={color-name} *highlight-guifg* guibg={color-name} *highlight-guibg* @@ -4817,6 +4864,9 @@ SignColumn column where |signs| are displayed *hl-IncSearch* IncSearch 'incsearch' highlighting; also used for the text replaced with ":s///c" + *hl-Substitute* +Substitute |:substitute| replacement text highlighting + *hl-LineNr* LineNr Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. @@ -4848,6 +4898,10 @@ PmenuSbar Popup menu: scrollbar. PmenuThumb Popup menu: Thumb of the scrollbar. *hl-Question* Question |hit-enter| prompt and yes/no questions + *hl-QuickFixLine* +QuickFixLine The selected |quickfix| item in the quickfix window. + |hl-CursorLine| is combined with this when the cursor is on + the currently selected quickfix item. *hl-Search* Search Last search pattern highlighting (see 'hlsearch'). Also used for highlighting the current line in the quickfix @@ -4887,8 +4941,6 @@ TabLineSel tab pages line, active tab page label Title titles for output from ":set all", ":autocmd" etc. *hl-Visual* Visual Visual mode selection - *hl-VisualNOS* -VisualNOS Removed. |vim-differences| {Nvim} *hl-WarningMsg* WarningMsg warning messages *hl-WildMenu* @@ -4992,6 +5044,9 @@ defaults back: > :syntax reset +It is a bit of a wrong name, since it does not reset any syntax items, it only +affects the highlighting. + This doesn't change the colors for the 'highlight' option. Note that the syntax colors that you set in your vimrc file will also be reset diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 70e6953211..4ab5b3c759 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -83,14 +83,21 @@ In the GUI tab pages line you can use the right mouse button to open menu. Execute {cmd} and when it opens a new window open a new tab page instead. Doesn't work for |:diffsplit|, |:diffpatch|, |:execute| and |:normal|. - When [count] is omitted the tab page appears after the current - one. - When [count] is specified the new tab page comes after tab - page [count]. Use ":0tab cmd" to get the new tab page as the - first one. + If [count] is given the new tab page appears after the tab + page [count] otherwise the new tab page will appear after the + current one. Examples: > - :tab split " opens current buffer in new tab page - :tab help gt " opens tab page with help for "gt" + :tab split " opens current buffer in new tab page + :tab help gt " opens tab page with help for "gt" + :.tab help gt " as above + :+tab help " opens tab page with help after the next + " tab page + :-tab help " opens tab page with help before the + " current one + :0tab help " opens tab page with help before the + " first one + :$tab help " opens tab page with help after the last + " one CTRL-W gf Open a new tab page and edit the file name under the cursor. See |CTRL-W_gf|. @@ -140,7 +147,7 @@ something else. :{count}tabo[nly][!] Close all tab pages except the {count}th one. > - :.tabonly " one + :.tabonly " as above :-tabonly " close all tab pages except the previous one :+tabonly " close all tab pages except the next one :1tabonly " close all tab pages except the first one diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 7d47368ba3..08ffee7a2f 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -473,7 +473,7 @@ correct values. One command can be used to set the screen size: - *:mod* *:mode* *E359* *E362* + *:mod* *:mode* :mod[e] Detects the screen size and redraws the screen. diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index 6a288f8965..c10643940d 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -1,4 +1,4 @@ -*usr_02.txt* For Vim version 7.4. Last change: 2015 Apr 12 +*usr_02.txt* For Vim version 7.4. Last change: 2016 Jan 16 VIM USER MANUAL - by Bram Moolenaar @@ -397,7 +397,15 @@ original version of the file. Everything you always wanted to know can be found in the Vim help files. Don't be afraid to ask! - To get generic help use this command: > + +If you know what you are looking for, it is usually easier to search for it +using the help system, instead of using Google. Because the subjects follow +a certain style guide. + +Also the help has the advantage of belonging to your particular Vim version. +You won't see help for commands added later. These would not work for you. + +To get generic help use this command: > :help @@ -471,7 +479,7 @@ example, use the following command: > :help 'number' -The table with all mode prefixes can be found here: |help-context|. +The table with all mode prefixes can be found below: |help-summary|. Special keys are enclosed in angle brackets. To find help on the up-arrow key in Insert mode, for instance, use this command: > @@ -488,64 +496,191 @@ You can use the error ID at the start to find help about it: > Summary: *help-summary* > - :help -< Gives you very general help. Scroll down to see a list of all - helpfiles, including those added locally (i.e. not distributed - with Vim). > - :help user-toc.txt -< Table of contents of the User Manual. > - :help :subject -< Ex-command "subject", for instance the following: > - :help :help -< Help on getting help. > - :help abc -< normal-mode command "abc". > - :help CTRL-B -< Control key <C-B> in Normal mode. > - :help i_abc - :help i_CTRL-B -< The same in Insert mode. > - :help v_abc - :help v_CTRL-B -< The same in Visual mode. > - :help c_abc - :help c_CTRL-B -< The same in Command-line mode. > - :help 'subject' -< Option 'subject'. > - :help subject() -< Function "subject". > - :help -subject -< Command-line argument "-subject". > - :help +subject -< Compile-time feature "+subject". > - :help /* -< Regular expression item "*" > - :help EventName -< Autocommand event "EventName". > - :help digraphs.txt -< The top of the helpfile "digraph.txt". - Similarly for any other helpfile. > - :help pattern<Tab> -< Find a help tag starting with "pattern". Repeat <Tab> for - others. > - :help pattern<Ctrl-D> -< See all possible help tag matches "pattern" at once. > - :helpgrep pattern -< Search the whole text of all help files for pattern "pattern". - Jumps to the first match. Jump to other matches with: > - :cn -< next match > - :cprev - :cN -< previous match > - :cfirst - :clast -< first or last match > - :copen - :cclose -< open/close the quickfix window; press <Enter> to jump - to the item under the cursor + +1) Use Ctrl-D after typing a topic and let Vim show all available topics. + Or press Tab to complete: > + :help some<Tab> +< More information on how to use the help: > + :help helphelp + +2) Follow the links in bars to related help. You can go from the detailed + help to the user documentation, which describes certain commands more from + a user perspective and less detailed. E.g. after: > + :help pattern.txt +< You can see the user guide topics |03.9| and |usr_27.txt| in the + introduction. + +3) Options are enclosed in single apostrophes. To go to the help topic for the + list option: > + :help 'list' +< If you only know you are looking for a certain option, you can also do: > + :help options.txt +< to open the help page which describes all option handling and then search + using regular expressions, e.g. textwidth. + Certain options have their own namespace, e.g.: > + :help cpo-<letter> +< for the corresponding flag of the 'cpoptions' settings, substitute <letter> + by a specific flag, e.g.: > + :help cpo-; +< And for the guioption flags: > + :help go-<letter> + +4) Normal mode commands do not have a prefix. To go to the help page for the + "gt" command: > + :help gt + +5) Insert mode commands start with i_. Help for deleting a word: > + :help i_CTRL-W + +6) Visual mode commands start with v_. Help for jumping to the other side of + the Visual area: > + :help v_o + +7) Command line editing and arguments start with c_. Help for using the + command argument %: > + :help c_% + +8) Ex-commands always start with ":", so to go to the :s command help: > + :help :s + +9) Commands specifically for debugging start with ">". To go to to the help + for the "cont" debug command: > + :help >cont + +10) Key combinations. They usually start with a single letter indicating + the mode for which they can be used. E.g.: > + :help i_CTRL-X +< takes you to the family of Ctrl-X commands for insert mode which can be + used to auto complete different things. Note, that certain keys will + always be written the same, e.g. Control will always be CTRL. + For normal mode commands there is no prefix and the topic is available at + :h CTRL-<Letter>. E.g. > + :help CTRL-W +< In contrast > + :help c_CTRL-R +< will describe what the Ctrl-R does when entering commands in the Command + line and > + :help v_Ctrl-A +< talks about incrementing numbers in visual mode and > + :help g_CTRL-A +< talks about the g<C-A> command (e.g. you have to press "g" then <Ctrl-A>). + Here the "g" stand for the normal command "g" which always expects a second + key before doing something similar to the commands starting with "z" + +11) Regexp items always start with /. So to get help for the "\+" quantifier + in Vim regexes: > + :help /\+ +< If you need to know everything about regular expressions, start reading + at: > + :help pattern.txt + +12) Registers always start with "quote". To find out about the special ":" + register: > + :help quote: + +13) Vim Script (VimL) is available at > + :help eval.txt +< Certain aspects of the language are available at :h expr-X where "X" is a + single letter. E.g. > + :help expr-! +< will take you to the topic describing the "!" (Not) operator for + VimScript. + Also important is > + :help function-list +< to find a short description of all functions available. Help topics for + VimL functions always include the "()", so: > + :help append() +< talks about the append VimL function rather than how to append text in the + current buffer. + +14) Mappings are talked about in the help page :h |map.txt|. Use > + :help mapmode-i +< to find out about the |:imap| command. Also use :map-topic + to find out about certain subtopics particular for mappings. e.g: > + :help :map-local +< for buffer-local mappings or > + :help map-bar +< for how the '|' is handled in mappings. + +15) Command definitions are talked about :h command-topic, so use > + :help command-bar +< to find out about the '!' argument for custom commands. + +16) Window management commands always start with CTRL-W, so you find the + corresponding help at :h CTRL-W_letter. E.g. > + :help CTRL-W_p +< for moving the previous accessed window. You can also access > + :help windows.txt +< and read your way through if you are looking for window handling + commands. + +17) Use |:helpgrep| to search in all help pages (and also of any installed + plugins). See |:helpgrep| for how to use it. + To search for a topic: > + :helpgrep topic +< This takes you to the first match. To go to the next one: > + :cnext +< All matches are available in the quickfix window which can be opened + with: > + :copen +< Move around to the match you like and press Enter to jump to that help. + +18) The user manual. This describes help topics for beginners in a rather + friendly way. Start at |usr_toc.txt| to find the table of content (as you + might have guessed): > + :help usr_toc.txt +< Skim over the contents to find interesting topics. The "Digraphs" and + "Entering special characters" items are in chapter 24, so to go to that + particular help page: > + :help usr_24.txt +< Also if you want to access a certain chapter in the help, the chapter + number can be accessed directly like this: > + :help 10.1 +< goes to chapter 10.1 in |usr_10.txt| and talks about recording macros. + +19) Highlighting groups. Always start with hl-groupname. E.g. > + :help hl-WarningMsg +< talks about the WarningMsg highlighting group. + +20) Syntax highlighting is namespaced to :syn-topic e.g. > + :help :syn-conceal +< talks about the conceal argument for the :syn command. + +21) Quickfix commands usually start with :c while location list commands + usually start with :l + +22) Autocommand events can be found by their name: > + :help BufWinLeave +< To see all possible events: > + :help autocommands-events + +23) Command-line switches always start with "-". So for the help of the -f + command switch of Vim use: > + :help -f + +24) Optional features always start with "+". To find out about the + conceal feature use: > + :help +conceal + +25) Documentation for included filetype specific functionality is usually + available in the form ft-<filetype>-<functionality>. So > + :help ft-c-syntax +< talks about the C syntax file and the option it provides. Sometimes, + additional sections for omni completion > + :help ft-php-omni +< or filetype plugins > + :help ft-tex-plugin +< are available. + +26) Error and Warning codes can be looked up directly in the help. So > + :help E297 +< takes you exactly to the description of the swap error message and > + :help W10 +< talks about the warning "Changing a readonly file". + Sometimes however, those error codes are not described, but rather are + listed at the Vim command that usually causes this. So: > + :help E128 +< takes you to the |:function| command ============================================================================== diff --git a/runtime/doc/usr_03.txt b/runtime/doc/usr_03.txt index b8f65d9309..943d7b528c 100644 --- a/runtime/doc/usr_03.txt +++ b/runtime/doc/usr_03.txt @@ -1,4 +1,4 @@ -*usr_03.txt* For Vim version 7.4. Last change: 2015 Dec 12 +*usr_03.txt* For Vim version 7.4. Last change: 2016 Jan 05 VIM USER MANUAL - by Bram Moolenaar @@ -414,8 +414,8 @@ in "the" use: > /the\> The "\>" item is a special marker that only matches at the end of a word. -Similarly "\<" only matches at the begin of a word. Thus to search for the -word "the" only: > +Similarly "\<" only matches at the beginning of a word. Thus to search for +the word "the" only: > /\<the\> diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index 5aecf33557..f920fd4591 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -1,4 +1,4 @@ -*usr_05.txt* For Vim version 7.4. Last change: 2012 Nov 20 +*usr_05.txt* For Vim version 7.4. Last change: 2016 Mar 28 VIM USER MANUAL - by Bram Moolenaar @@ -12,10 +12,11 @@ Vim's capabilities. Or define your own macros. |05.1| The vimrc file |05.2| The example vimrc file explained |05.3| Simple mappings -|05.4| Adding a plugin -|05.5| Adding a help file -|05.6| The option window -|05.7| Often used options +|05.4| Adding a package +|05.5| Adding a plugin +|05.6| Adding a help file +|05.7| The option window +|05.8| Often used options Next chapter: |usr_06.txt| Using syntax highlighting Previous chapter: |usr_04.txt| Making small changes @@ -245,7 +246,47 @@ The ":map" command (with no arguments) lists your current mappings. At least the ones for Normal mode. More about mappings in section |40.1|. ============================================================================== -*05.4* Adding a plugin *add-plugin* *plugin* +*05.4* Adding a package *add-package* *vimball-install* + +A package is a set of files that you can add to Vim. There are two kinds of +packages: optional and automatically loaded on startup. + +The Vim distribution comes with a few packages that you can optionally use. +For example, the vimball plugin. This plugin supports creating and using +vimballs (self-installing Vim plugin archives). + +To start using the vimball plugin, add one line to your vimrc file: > + packadd vimball + +That's all! You can also type the command to try it out. Now you can find +help about this plugin: > + :help vimball + +This works, because when `:packadd` loaded the plugin it also added the +package directory in 'runtimepath', so that the help file can be found. The +tags for vimball's help are already created. If you need to generate the help +tags for a package, see the `:helptags` command. + +You can find packages on the Internet in various places. It usually comes as +an archive or as a repository. For an archive you can follow these steps: + 1. create the package directory: > + mkdir -p ~/.local/share/nvim/site/pack/fancy +< "fancy" can be any name of your liking. Use one that describes the + package. + 2. unpack the archive in that directory. This assumes the top + directory in the archive is "start": > + cd ~/.local/share/nvim/site/pack/fancy + unzip /tmp/fancy.zip +< If the archive layout is different make sure that you end up with a + path like this: + ~/.local/share/nvim/site/pack/fancy/start/fancytext/plugin/fancy.vim ~ + Here "fancytext" is the name of the package, it can be anything + else. + +More information about packages can be found here: |packages|. + +============================================================================== +*05.5* Adding a plugin *add-plugin* *plugin* Vim's functionality can be extended by adding plugins. A plugin is nothing more than a Vim script file that is loaded automatically when Vim starts. You @@ -299,10 +340,9 @@ Then copy the file to your plugin directory: Example for Unix (assuming you didn't have a plugin directory yet): > mkdir -p ~/.local/share/nvim/site/plugin - cp /usr/local/share/vim/vim60/macros/justify.vim ~/.local/share/nvim/site/plugin + cp /tmp/yourplugin.vim ~/.local/share/nvim/site/plugin -That's all! Now you can use the commands defined in this plugin to justify -text. +That's all! Now you can use the commands defined in this plugin. Instead of putting plugins directly into the plugin/ directory, you may better organize them by putting them into subdirectories under plugin/. @@ -384,7 +424,7 @@ Further reading: |new-filetype| How to detect a new file type. ============================================================================== -*05.5* Adding a help file *add-local-help* +*05.6* Adding a help file *add-local-help* If you are lucky, the plugin you installed also comes with a help file. We will explain how to install the help file, so that you can easily find help @@ -417,7 +457,7 @@ them through the tag. For writing a local help file, see |write-local-help|. ============================================================================== -*05.6* The option window +*05.7* The option window If you are looking for an option that does what you want, you can search in the help files here: |options|. Another way is by using this command: > @@ -456,7 +496,7 @@ border. This is what the 'scrolloff' option does, it specifies an offset from the window border where scrolling starts. ============================================================================== -*05.7* Often used options +*05.8* Often used options There are an awful lot of options. Most of them you will hardly ever use. Some of the more useful ones will be mentioned here. Don't forget you can diff --git a/runtime/doc/usr_12.txt b/runtime/doc/usr_12.txt index 237abae55f..f64a230576 100644 --- a/runtime/doc/usr_12.txt +++ b/runtime/doc/usr_12.txt @@ -237,19 +237,8 @@ simple way: Move the cursor to the word you want to find help on and press > K -Vim will run the external "man" program on the word. If the man page is -found, it is displayed. This uses the normal pager to scroll through the text -(mostly the "more" program). When you get to the end pressing <Enter> will -get you back into Vim. - -A disadvantage is that you can't see the man page and the text you are working -on at the same time. There is a trick to make the man page appear in a Vim -window. First, load the man filetype plugin: > - - :runtime! ftplugin/man.vim - -Put this command in your vimrc file if you intend to do this often. Now you -can use the ":Man" command to open a window on a man page: > +Nvim will run |:Man| on the word. If the man page is found, it is displayed. +You can also use the |:Man| command to open a window on a man page: > :Man csh @@ -267,15 +256,14 @@ window. To display a man page for the word under the cursor, use this: > - \K + K -(If you redefined the <Leader>, use it instead of the backslash). For example, you want to know the return value of "strstr()" while editing this line: if ( strstr (input, "aap") == ) ~ -Move the cursor to somewhere on "strstr" and type "\K". A window will open +Move the cursor to somewhere on "strstr" and type "K". A window will open to display the man page for strstr(). ============================================================================== diff --git a/runtime/doc/usr_25.txt b/runtime/doc/usr_25.txt index 23d76a8b0f..24420353dd 100644 --- a/runtime/doc/usr_25.txt +++ b/runtime/doc/usr_25.txt @@ -1,4 +1,4 @@ -*usr_25.txt* For Vim version 7.4. Last change: 2014 Oct 29 +*usr_25.txt* For Vim version 7.4. Last change: 2016 Mar 28 VIM USER MANUAL - by Bram Moolenaar @@ -196,12 +196,16 @@ Vim has no built-in way of justifying text. However, there is a neat macro package that does the job. To use this package, execute the following command: > - :runtime macros/justify.vim + :packadd justify + +Or put this line in your |vimrc|: > + + packadd! justify This Vim script file defines a new visual command "_j". To justify a block of text, highlight the text in Visual mode and then execute "_j". Look in the file for more explanations. To go there, do "gf" on this name: -$VIMRUNTIME/macros/justify.vim. +$VIMRUNTIME/pack/dist/opt/justify/plugin/justify.vim. An alternative is to filter the text through an external program. Example: > diff --git a/runtime/doc/usr_29.txt b/runtime/doc/usr_29.txt index e495aad06d..9eb66ce83c 100644 --- a/runtime/doc/usr_29.txt +++ b/runtime/doc/usr_29.txt @@ -1,4 +1,4 @@ -*usr_29.txt* For Vim version 7.4. Last change: 2008 Jun 28 +*usr_29.txt* For Vim version 7.4. Last change: 2016 Feb 27 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index fc8419a522..191b0871f4 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 7.4. Last change: 2015 Nov 30 +*usr_41.txt* For Vim version 7.4. Last change: 2016 Aug 07 VIM USER MANUAL - by Bram Moolenaar @@ -592,6 +592,7 @@ String manipulation: *string-functions* match() position where a pattern matches in a string matchend() position where a pattern match ends in a string matchstr() match of a pattern in a string + matchstrpos() match and positions of a pattern in a string matchlist() like matchstr() and also return submatches stridx() first index of a short string in a long string strridx() last index of a short string in a long string @@ -601,13 +602,16 @@ String manipulation: *string-functions* strdisplaywidth() size of string when displayed, deals with tabs substitute() substitute a pattern match with a string submatch() get a specific match in ":s" and substitute() - strpart() get part of a string + strpart() get part of a string using byte index + strcharpart() get part of a string using char index + strgetchar() get character from a string using char index expand() expand special keywords iconv() convert text from one encoding to another byteidx() byte index of a character in a string byteidxcomp() like byteidx() but count composing characters repeat() repeat a string multiple times eval() evaluate a string expression + execute() execute an Ex command and get the output List manipulation: *list-functions* get() get an item without error for wrong index @@ -731,11 +735,14 @@ Working with text in the current buffer: *text-functions* searchpair() find the other end of a start/skip/end searchpairpos() find the other end of a start/skip/end searchdecl() search for the declaration of a name + getcharsearch() return character search information + setcharsearch() set character search information *system-functions* *file-functions* System functions and manipulation of files: glob() expand wildcards globpath() expand wildcards in a number of directories + glob2regpat() convert a glob pattern into a search pattern findfile() find a file in a list of directories finddir() find a directory in a list of directories resolve() find out where a shortcut points to @@ -747,6 +754,7 @@ System functions and manipulation of files: filereadable() check if a file can be read filewritable() check if a file can be written to getfperm() get the permissions of a file + setfperm() set the permissions of a file getftype() get the kind of a file isdirectory() check if a directory exists getfsize() get the size of a file @@ -768,6 +776,7 @@ Date and Time: *date-functions* *time-functions* strftime() convert time to a string reltime() get the current or elapsed time accurately reltimestr() convert reltime() result to a string + reltimefloat() convert reltime() result to a Float *buffer-functions* *window-functions* *arg-functions* Buffers, windows and the argument list: @@ -784,9 +793,18 @@ Buffers, windows and the argument list: tabpagenr() get the number of a tab page tabpagewinnr() like winnr() for a specified tab page winnr() get the window number for the current window + bufwinid() get the window ID of a specific buffer bufwinnr() get the window number of a specific buffer winbufnr() get the buffer number of a specific window getbufline() get a list of lines from the specified buffer + win_findbuf() find windows containing a buffer + win_getid() get window ID of a window + win_gotoid() go to window with ID + win_id2tabwin() get tab and window nr from window ID + win_id2win() get window nr from window ID + getbufinfo() get a list with buffer information + gettabinfo() get a list with tab page information + getwininfo() get a list with window information Command line: *command-line-functions* getcmdline() get the current command line @@ -794,6 +812,7 @@ Command line: *command-line-functions* setcmdpos() set position of the cursor in the command line getcmdtype() return the current command-line type getcmdwintype() return the current command-line window type + getcompletion() list of command-line completion matches Quickfix and location lists: *quickfix-functions* getqflist() list of quickfix errors @@ -889,9 +908,19 @@ Mappings: *mapping-functions* wildmenumode() check if the wildmode is active Testing: *test-functions* - assert_equal() assert that two expressions values are equal + assert_equal() assert that two expressions values are equal + assert_notequal() assert that two expressions values are not equal + assert_inrange() assert that an expression is inside a range + assert_match() assert that a pattern matches the value + assert_notmatch() assert that a pattern does not match the value assert_false() assert that an expression is false assert_true() assert that an expression is true + assert_exception() assert that a command throws an exception + assert_fails() assert that a function call fails + +Timers: *timer-functions* + timer_start() create a timer + timer_stop() stop a timer Various: *various-functions* mode() get current editing mode @@ -916,12 +945,13 @@ Various: *various-functions* shiftwidth() effective value of 'shiftwidth' + wordcount() get byte/word/char count of buffer + taglist() get list of matching tags tagfiles() get a list of tags files py3eval() evaluate Python expression (|+python3|) pyeval() evaluate Python expression (|+python|) - wordcount() get byte/word/char count of buffer ============================================================================== *41.7* Defining a function @@ -1389,9 +1419,9 @@ Now we can instantiate a Dutch translation object: > And a German translator: > :let uk2de = copy(transdict) - :let uk2de.words = {'one': 'ein', 'two': 'zwei', 'three': 'drei'} + :let uk2de.words = {'one': 'eins', 'two': 'zwei', 'three': 'drei'} :echo uk2de.translate('three one') -< drei ein ~ +< drei eins ~ You see that the copy() function is used to make a copy of the "transdict" Dictionary and then the copy is changed to add the words. The original @@ -2224,7 +2254,7 @@ This construct makes sure the function is only defined once: > :endif < -UNDO *undo_ftplugin* +UNDO *undo_indent* *undo_ftplugin* When the user does ":setfiletype xyz" the effect of the previous filetype should be undone. Set the b:undo_ftplugin variable to the commands that will @@ -2239,6 +2269,9 @@ global value. That is mostly the best way to reset the option value. This does require removing the "C" flag from 'cpoptions' to allow line continuation, as mentioned above |use-cpo-save|. +For undoing the effect of an indent script, the b:undo_indent variable should +be set accordingly. + FILE NAME diff --git a/runtime/doc/usr_toc.txt b/runtime/doc/usr_toc.txt index 77ea462a23..e021b806e3 100644 --- a/runtime/doc/usr_toc.txt +++ b/runtime/doc/usr_toc.txt @@ -1,4 +1,4 @@ -*usr_toc.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*usr_toc.txt* For Vim version 7.4. Last change: 2016 Mar 25 VIM USER MANUAL - by Bram Moolenaar @@ -101,10 +101,11 @@ Read this from start to end to learn the essential commands. |05.1| The vimrc file |05.2| The example vimrc file explained |05.3| Simple mappings - |05.4| Adding a plugin - |05.5| Adding a help file - |05.6| The option window - |05.7| Often used options + |05.4| Adding a package + |05.5| Adding a plugin + |05.6| Adding a help file + |05.7| The option window + |05.8| Often used options |usr_06.txt| Using syntax highlighting |06.1| Switching it on diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index af4224993f..7d08a6f32a 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.4. Last change: 2015 Nov 15 +*various.txt* For Vim version 7.4. Last change: 2016 Jul 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -220,7 +220,7 @@ g8 Print the hex values of the bytes used in the Like |:enew|, it will fail if the current buffer is modified, but can be forced with "!". See |termopen()| - and |nvim-terminal-emulator| for more information. + and |terminal-emulator|. To switch to terminal mode automatically: > @@ -255,14 +255,20 @@ g8 Print the hex values of the bytes used in the backslashes are before the newline, only one is removed. - On Unix the command normally runs in a non-interactive - shell. If you want an interactive shell to be used - (to use aliases) set 'shellcmdflag' to "-ic". + The command runs in a non-interactive shell connected + to a pipe (not a terminal). Use |:terminal| to run an + interactive shell connected to a terminal. + For Win32 also see |:!start|. After the command has been executed, the timestamp and size of the current file is checked |timestamp|. + If the command produces too much output some lines may + be skipped so the command can execute quickly. No + data is lost, this only affects the display. The last + few lines are always displayed (never skipped). + Vim redraws the screen after the command is finished, because it may have printed any text. This requires a hit-enter prompt, so that you can read any messages. @@ -319,8 +325,7 @@ N *+dialog_con* Support for |:confirm| with console dialog. N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog. N *+digraphs* |digraphs| *E196* N *+eval* expression evaluation |eval.txt| -N *+ex_extra* Vim's extra Ex commands: |:center|, |:left|, - |:normal|, |:retab| and |:right| +N *+ex_extra* always on now, used to be for Vim's extra Ex commands N *+extra_search* |'hlsearch'| and |'incsearch'| options. B *+farsi* |farsi| language N *+file_in_path* |gf|, |CTRL-W_f| and |<cfile>| @@ -376,6 +381,7 @@ B *+termguicolors* 24-bit color in xterm-compatible terminals support N *+termresponse* support for |t_RV| and |v:termresponse| N *+textobjects* |text-objects| selection *+tgetent* non-Unix only: able to use external termcap +N *+timers* the |timer_start()| function N *+title* Setting the window 'title' and 'icon' N *+toolbar* |gui-toolbar| N *+user_commands* User-defined commands. |user-commands| @@ -410,14 +416,18 @@ m *+xpm_w32* Win32 GUI only: pixmap support |w32-xpm-support| shown on the screen. When [!] is included, an existing file is overwritten. When [!] is omitted, and {file} exists, this command fails. + Only one ":redir" can be active at a time. Calls to ":redir" will close any active redirection before - starting redirection to the new target. + starting redirection to the new target. For recursive + use check out |execute()|. + To stop the messages and commands from being echoed to the screen, put the commands in a function and call it with ":silent call Function()". - An alternative is to use the 'verbosefile' option, - this can be used in combination with ":redir". + Alternatives are the 'verbosefile' option or + |execute()| function, these can be used in combination + with ":redir". :redi[r] >> {file} Redirect messages to file {file}. Append if {file} already exists. @@ -449,13 +459,15 @@ m *+xpm_w32* Win32 GUI only: pixmap support |w32-xpm-support| redirection starts, if the variable is removed or locked or the variable type is changed, then further command output messages will cause errors. + To get the output of one command the |execute()| + function can be used. :redi[r] =>> {var} Append messages to an existing variable. Only string variables can be used. :redi[r] END End redirecting messages. - *:sil* *:silent* + *:sil* *:silent* *:silent!* :sil[ent][!] {command} Execute {command} silently. Normal messages will not be given or added to the message history. When [!] is added, error messages will also be diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index ec35694c9e..54ef8fecb2 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -1,4 +1,4 @@ -*vi_diff.txt* For Vim version 7.4. Last change: 2015 Nov 01 +*vi_diff.txt* For Vim version 7.4. Last change: 2016 Feb 12 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 508712ca75..20002c1118 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -12,8 +12,8 @@ these differences. 1. Configuration |nvim-configuration| 2. Defaults |nvim-defaults| -3. Changed features |nvim-features-changed| -4. New features |nvim-features-new| +3. New features |nvim-features| +4. Changed features |nvim-features-changed| 5. Missing legacy features |nvim-features-missing| 6. Removed features |nvim-features-removed| @@ -36,9 +36,10 @@ these differences. - 'autoindent' is set by default - 'autoread' is set by default - 'backspace' defaults to "indent,eol,start" +- 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|) - 'complete' doesn't include "i" +- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created - 'display' defaults to "lastline" -- 'encoding' defaults to "utf-8" - 'formatoptions' defaults to "tcqj" - 'history' defaults to 10000 (the maximum) - 'hlsearch' is set by default @@ -46,7 +47,6 @@ these differences. - 'langnoremap' is set by default - 'laststatus' defaults to 2 (statusline is always shown) - 'listchars' defaults to "tab:> ,trail:-,nbsp:+" -- 'mouse' defaults to "a" - 'nocompatible' is always set - 'nrformats' defaults to "bin,hex" - 'sessionoptions' doesn't include "options" @@ -54,11 +54,94 @@ these differences. - 'tabpagemax' defaults to 50 - 'tags' defaults to "./tags;,tags" - 'ttyfast' is always set +- 'undodir' defaults to ~/.local/share/nvim/undo (|xdg|), auto-created - 'viminfo' includes "!" - 'wildmenu' is set by default ============================================================================== -3. Changed features *nvim-features-changed* +3. New Features *nvim-features* + + +MAJOR COMPONENTS ~ + +Embedded terminal emulator |terminal-emulator| +RPC API |RPC| +Shared data |shada| +XDG base directories |xdg| +Job control |job-control| +Remote plugins |remote-plugin| +Python plugins |provider-python| +Clipboard integration |provider-clipboard| + + +USER EXPERIENCE ~ + +Working intuitively and consistently is a major goal of Nvim. Examples: + +- Nvim does not have `-X`, a platform-specific option "sometimes" available in + Vim (with potential surprises: http://stackoverflow.com/q/14635295). Nvim + avoids features that cannot be provided on all platforms--instead that is + delegated to external plugins/extensions. + +- Test-only globals and functions such as test_autochdir(), test_settime(), + etc., are not exposed (because they don't exist). + +ARCHITECTURE ~ + +External plugins run in separate processes. |remote-plugin| This improves +stability and allows those plugins to perform tasks without blocking the +editor. Even "legacy" Python and Ruby plugins which use the old Vim interfaces +(|if_py| and |if_ruby|) run out-of-process. + + +FEATURES ~ + +|bracketed-paste-mode| is built-in and enabled by default. + +|META| (ALT) chords are recognized, even in the terminal. Any |<M-| mapping +will work. Some examples: <M-1>, <M-2>, <M-BS>, <M-Del>, <M-Ins>, <M-/>, +<M-\>, <M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ... +META chords are case-sensitive: <M-a> and <M-A> are two different keycodes. + +Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants +(even in the terminal). Specifically, the following are known to work: + <C-Tab>, <C-S-Tab>, <C-BS>, <C-S-BS>, <C-Enter>, <C-S-Enter> + +Options: + 'inccommand' shows results while typing a |:substitute| command + 'statusline' supports unlimited alignment sections + 'tabline' %@Func@foo%X can call any function on mouse-click + +Variables: + |v:event| + |v:windowid| is always available (for use by external UIs) + +Commands: + |:CheckHealth| + |:drop| is available on all platforms + |:Man| is available by default, with many improvements such as completion + +Functions: + |dictwatcheradd()| notifies a callback whenever a |Dict| is modified + |dictwatcherdel()| + |execute()| works with |:redir| + |msgpackdump()|, |msgpackparse()| provide msgpack de/serialization + +Events: + |DirChanged| + |TabNewEntered| + |TermClose| + |TermOpen| + |TextYankPost| + +Highlight groups: + |hl-QuickFixLine| + |hl-Substitute| + |hl-TermCursor| + |hl-TermCursorNC| + +============================================================================== +4. Changed features *nvim-features-changed* Nvim always builds with all features, in contrast to Vim which may have certain features removed/added at compile-time. This is like if Vim's "HUGE" @@ -68,7 +151,16 @@ build). If a Python interpreter is available on your `$PATH`, |:python| and |:python3| are always available and may be used simultaneously in separate plugins. The `neovim` pip package must be installed to use Python plugins in Nvim (see -|nvim-python|). +|provider-python|). + +|:!| does not support "interactive" commands. Use |:terminal| instead. +(GUI Vim has a similar limitation, see ":help gui-pty" in Vim.) + +|system()| does not support writing/reading "backgrounded" commands. |E5677| + +Nvim may throttle (skip) messages from shell commands (|:!|, |:grep|, |:make|) +if there is too much output. No data is lost, this only affects display and +makes things faster. |:terminal| output is never throttled. |mkdir()| behaviour changed: 1. Assuming /tmp/foo does not exist and /tmp can be written to @@ -78,7 +170,7 @@ are always available and may be used simultaneously in separate plugins. The 'p')) mkdir() will silently exit. In Vim this was an error. 3. mkdir() error messages now include strerror() text when mkdir fails. -'encoding' cannot be changed after startup. +'encoding' is always "utf-8". |string()| and |:echo| behaviour changed: 1. No maximum recursion depth limit is applied to nested container @@ -127,7 +219,6 @@ Additional differences: compatibility reasons. - |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old commands are still kept. -- |:oldfiles| supports !. - When writing (|:wshada| without bang or at exit) it merges much more data, and does this according to the timestamp. Vim merges only marks. |shada-merging| @@ -141,47 +232,13 @@ Additional differences: - ShaDa file keeps search direction (|v:searchforward|), viminfo does not. ============================================================================== -4. New Features *nvim-features-new* - -See |nvim-intro| for a list of Nvim's largest new features. - -|bracketed-paste-mode| is built-in and enabled by default. - -Meta (alt) chords are recognized (even in the terminal). - <M-1>, <M-2>, ... - <M-BS>, <M-Del>, <M-Ins>, ... - <M-/>, <M-\>, ... - <M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ... - - Note: Meta chords are case-sensitive (<M-a> is distinguished from <M-A>). - -Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants -(even in the terminal). Specifically, the following are known to work: - <C-Tab>, <C-S-Tab> - <C-BS>, <C-S-BS> - <C-Enter>, <C-S-Enter> - -Events: - |TabNew| - |TabNewEntered| - |TabClosed| - |TermOpen| - |TermClose| - -Highlight groups: - |hl-EndOfBuffer| - |hl-TermCursor| - |hl-TermCursorNC| - -============================================================================== 5. Missing legacy features *nvim-features-missing* - *if_ruby* *if_lua* *if_perl* *if_mzscheme* *if_tcl* + *if_lua* *if_perl* *if_mzscheme* *if_tcl* These legacy Vim features may be implemented in the future, but they are not planned for the current milestone. -- vim.bindeval() (new feature in Vim 7.4 Python interface) -- |if_ruby| +- |if_py|: vim.bindeval() and vim.Function() are not supported - |if_lua| - |if_perl| - |if_mzscheme| @@ -192,10 +249,12 @@ planned for the current milestone. These features are in Vim, but have been intentionally removed from Nvim. -Vi-compatible mode: + *'cp'* *'nocompatible'* *'nocp'* *'compatible'* +Nvim is always "non-compatible" with Vi. ":set nocompatible" is ignored ":set compatible" is an error + *'ed'* *'edcompatible'* *'noed'* *'noedcompatible'* Ed-compatible mode: ":set noedcompatible" is ignored ":set edcompatible" is an error @@ -205,8 +264,8 @@ Ed-compatible mode: ":set nottyfast" is an error Encryption support: - 'cryptmethod' - 'key' + *'cryptmethod'* *'cm'* + *'key'* MS-DOS support: 'bioskey' @@ -215,29 +274,43 @@ MS-DOS support: Highlight groups: |hl-VisualNOS| +Test functions: + test_alloc_fail() + test_autochdir() + test_disable_char_avail() + test_garbagecollect_now() + test_null_channel() + test_null_dict() + test_null_job() + test_null_list() + test_null_partial() + test_null_string() + test_settime() + Other options: 'antialias' - 'cpoptions' ('g', 'w', 'H', '*', '-', 'j', and all POSIX flags were removed) - 'guioptions' (only the 't' flag was removed) - 'guipty' - 'imactivatefunc' - 'imactivatekey' - 'imstatusfunc' - 'macatsui' - 'restorescreen' + 'cpoptions' ("g", "w", "H", "*", "-", "j", and all POSIX flags were removed) + 'encoding' ("utf-8" is always used) + 'guioptions' "t" flag was removed + *'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.) + *'imactivatefunc'* *'imaf'* + *'imactivatekey'* *'imak'* + *'imstatusfunc'* *'imsf'* + *'macatsui'* + *'restorescreen'* *'rs'* *'norestorescreen'* *'nors'* 'shelltype' - 'shortname' - 'swapsync' - 'term' - 'termencoding' (Vim 7.4.852 also removed this for Windows) + *'shortname'* *'sn'* *'noshortname'* *'nosn'* + *'swapsync'* *'sws'* + *'term'* *E529* *E530* *E531* + *'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows) 'textauto' 'textmode' - 'toolbar' - 'toolbariconsize' - 'ttybuiltin' - 'ttymouse' - 'ttyscroll' - 'ttytype' + *'toolbar'* *'tb'* + *'toolbariconsize'* *'tbis'* + *'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'* + *'ttymouse'* *'ttym'* + *'ttyscroll'* *'tsl'* + *'ttytype'* *'tty'* 'weirdinvert' Other commands: @@ -247,6 +320,7 @@ Other commands: :mode (no longer accepts an argument) :open :shell + :smile :tearoff Other compile-time features: diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 51b73223b6..5b94626e36 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 7.4. Last change: 2015 Nov 14 +*windows.txt* For Vim version 7.4. Last change: 2016 Jun 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -70,6 +70,16 @@ places where a Normal mode command can't be used or is inconvenient. The main Vim window can hold several split windows. There are also tab pages |tab-page|, each of which can hold multiple windows. +Each window has a unique identifier called the window ID. This identifier +will not change within a Vim session. The |win_getid()| and |win_id2tabwin()| +functions can be used to convert between the window/tab number and the +identifier. There is also the window number, which may change whenever +windows are opened or closed, see |winnr()|. + +Each buffer has a unique number and the number will not change within a Vim +session. The |bufnr()| and |bufname()| functions can be used to convert +between a buffer name and the buffer number. + ============================================================================== 2. Starting Vim *windows-starting* @@ -707,8 +717,8 @@ can also get to them with the buffer list commands, like ":bnext". *:bufdo* :[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if [range] is given only for buffers for which their - buffer name is in the [range]. It works like doing - this: > + buffer number is in the [range]. It works like doing + this: > :bfirst :{cmd} :bnext diff --git a/runtime/filetype.vim b/runtime/filetype.vim index c5a3577a62..24587c56dc 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Oct 13 +" Last Change: 2016 Jul 21 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -530,7 +530,7 @@ au BufNewFile,BufRead configure.in,configure.ac setf config au BufNewFile,BufRead *.cu setf cuda " Dockerfile -au BufNewFile,BufRead Dockerfile setf dockerfile +au BufNewFile,BufRead Dockerfile,*.Dockerfile setf dockerfile " WildPackets EtherPeek Decoder au BufNewFile,BufRead *.dcd setf dcd @@ -1015,7 +1015,7 @@ au BufNewFile,BufRead *.jgr setf jgraph au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial " JSON -au BufNewFile,BufRead *.json,*.jsonp setf json +au BufNewFile,BufRead *.json,*.jsonp,*.webmanifest setf json " Kixtart au BufNewFile,BufRead *.kix setf kix @@ -1143,7 +1143,7 @@ au BufNewFile,BufRead *.ist,*.mst setf ist au BufNewFile,BufRead *.page setf mallard " Manpage -au BufNewFile,BufRead *.man setf man +au BufNewFile,BufRead *.man setf nroff " Man config au BufNewFile,BufRead */etc/man.conf,man.config setf manconf @@ -1617,11 +1617,9 @@ au BufNewFile,BufRead */etc/protocols setf protocols " Pyrex au BufNewFile,BufRead *.pyx,*.pxd setf pyrex -" Python -au BufNewFile,BufRead *.py,*.pyw setf python - +" Python, Python Shell Startup Files " Quixote (Python-based web framework) -au BufNewFile,BufRead *.ptl setf python +au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl setf python " Radiance au BufNewFile,BufRead *.rad,*.mat setf radiance diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim index 487ce7a165..3717ea92a9 100644 --- a/runtime/ftplugin/c.vim +++ b/runtime/ftplugin/c.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Jul 10 +" Last Change: 2016 Jun 12 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -32,7 +32,7 @@ setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// " When the matchit plugin is loaded, this makes the % command skip parens and " braces in comments. let b:match_words = &matchpairs . ',^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' -let b:match_skip = 's:comment\|string\|character' +let b:match_skip = 's:comment\|string\|character\|special' " Win32 can filter files in the browse dialog if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") @@ -55,5 +55,7 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") endif endif +let b:man_default_sects = '3,2' + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/clojure.vim b/runtime/ftplugin/clojure.vim index 10fcb9f205..217711f26e 100644 --- a/runtime/ftplugin/clojure.vim +++ b/runtime/ftplugin/clojure.vim @@ -1,11 +1,11 @@ " Vim filetype plugin file -" Language: Clojure -" Author: Meikel Brandmeyer <mb@kotka.de> +" Language: Clojure +" Author: Meikel Brandmeyer <mb@kotka.de> " -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 if exists("b:did_ftplugin") finish @@ -43,7 +43,7 @@ setlocal commentstring=;\ %s " specially and hence are not indented specially. " " -*- LISPWORDS -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test " Provide insert mode completions for special forms and clojure.core. As @@ -82,9 +82,9 @@ endif " Win32 can filter files in the browse dialog if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" . - \ "ClojureScript Source Files (*.cljs)\t*.cljs\n" . - \ "Java Source Files (*.java)\t*.java\n" . - \ "All Files (*.*)\t*.*\n" + \ "ClojureScript Source Files (*.cljs)\t*.cljs\n" . + \ "Java Source Files (*.java)\t*.java\n" . + \ "All Files (*.*)\t*.*\n" let b:undo_ftplugin .= ' | unlet! b:browsefilter' endif diff --git a/runtime/ftplugin/eiffel.vim b/runtime/ftplugin/eiffel.vim new file mode 100644 index 0000000000..216fdde162 --- /dev/null +++ b/runtime/ftplugin/eiffel.vim @@ -0,0 +1,96 @@ +" Vim filetype plugin +" Language: Eiffel +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2010 Aug 29 + +if (exists("b:did_ftplugin")) + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=:-- +setlocal commentstring=--\ %s + +setlocal formatoptions-=t formatoptions+=croql + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Eiffel Source Files (*.e)\t*.e\n" . + \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n" . + \ "All Files (*.*)\t*.*\n" +endif + +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 0 + " Silly \%^ trick to match note at head of pair and in middle prevents + " 'g%' wrapping from 'note' to 'end' + let b:match_words = '\%^:' . + \ '\<\%(^note\|indexing\|class\|^obsolete\|inherit\|insert\|^create\|convert\|feature\|^invariant\)\>:' . + \ '^end\>,' . + \ '\<\%(do\|deferred\|external\|once\%(\s\+"\)\@!\|check\|debug\|if\|inspect\|from\|across\)\>:' . + \ '\%(\%(^\s\+\)\@<=\%(then\|until\|loop\)\|\%(then\|until\|loop\)\s\+[^ -]\|' . + \ '\<\%(ensure\%(\s\+then\)\=\|rescue\|_then\|elseif\|else\|when\|\s\@<=invariant\|_until\|_loop\|variant\|_as\|alias\)\>\):' . + \ '\s\@<=end\>' + let b:match_skip = 's:\<eiffel\%(Comment\|String\|Operator\)\>' + noremap [% <Nop> + noremap ]% <Nop> + vnoremap a% <Nop> +endif + +let b:undo_ftplugin = "setl fo< com< cms<" . + \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" + +if !exists("g:no_plugin_maps") && !exists("g:no_eiffel_maps") + function! s:DoMotion(pattern, count, flags) abort + normal! m' + for i in range(a:count) + call search(a:pattern, a:flags) + endfor + endfunction + + let sections = '^\%(note\|indexing\|' . + \ '\%(\%(deferred\|expanded\|external\|frozen\)\s\+\)*class\|' . + \ 'obsolete\|inherit\|insert\|create\|convert\|feature\|' . + \ 'invariant\|end\)\>' + + nnoremap <silent> <buffer> ]] :<C-U>call <SID>DoMotion(sections, v:count1, 'W')<CR> + xnoremap <silent> <buffer> ]] :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'W')<CR> + nnoremap <silent> <buffer> [[ :<C-U>call <SID>DoMotion(sections, v:count1, 'Wb')<CR> + xnoremap <silent> <buffer> [[ :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'Wb')<CR> + + function! s:DoFeatureMotion(count, flags) + let view = winsaveview() + call cursor(1, 1) + let [features_start, _] = searchpos('^feature\>') + call search('^\s\+\a') " find the first feature + let spaces = indent(line('.')) + let [features_end, _] = searchpos('^\%(invariant\|note\|end\)\>') + call winrestview(view) + call s:DoMotion('\%>' . features_start . 'l\%<' . features_end . 'l^\s*\%' . (spaces + 1) . 'v\zs\a', a:count, a:flags) + endfunction + + nnoremap <silent> <buffer> ]m :<C-U>call <SID>DoFeatureMotion(v:count1, 'W')<CR> + xnoremap <silent> <buffer> ]m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'W')<CR> + nnoremap <silent> <buffer> [m :<C-U>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR> + xnoremap <silent> <buffer> [m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR> + + let comment_block_start = '^\%(\s\+--.*\n\)\@<!\s\+--' + let comment_block_end = '^\s\+--.*\n\%(\s\+--\)\@!' + + nnoremap <silent> <buffer> ]- :<C-U>call <SID>DoMotion(comment_block_start, 1, 'W')<CR> + xnoremap <silent> <buffer> ]- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_start, 1, 'W')<CR> + nnoremap <silent> <buffer> [- :<C-U>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR> + xnoremap <silent> <buffer> [- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR> + + let b:undo_ftplugin = b:undo_ftplugin . + \ "| silent! execute 'unmap <buffer> [[' | silent! execute 'unmap <buffer> ]]'" . + \ "| silent! execute 'unmap <buffer> [m' | silent! execute 'unmap <buffer> ]m'" . + \ "| silent! execute 'unmap <buffer> [-' | silent! execute 'unmap <buffer> ]-'" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/groovy.vim b/runtime/ftplugin/groovy.vim new file mode 100644 index 0000000000..cc7d6e35eb --- /dev/null +++ b/runtime/ftplugin/groovy.vim @@ -0,0 +1,19 @@ +" Vim filetype plugin file +" Language: groovy +" Maintainer: Justin M. Keyes <justinkz@gmail.com> +" Last Change: 2016 May 22 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo-=C + +let b:undo_ftplugin = 'setlocal commentstring<' + +setlocal commentstring=//%s + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/hgcommit.vim b/runtime/ftplugin/hgcommit.vim new file mode 100644 index 0000000000..d5a6c0a383 --- /dev/null +++ b/runtime/ftplugin/hgcommit.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: hg (Mercurial) commit file +" Maintainer: Ken Takata <kentkt at csc dot jp> +" Last Change: 2016 Jan 6 +" Filenames: hg-editor-*.txt +" License: VIM License +" URL: https://github.com/k-takata/hg-vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal nomodeline + +let b:undo_ftplugin = 'setl modeline<' diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 04ab539fb1..5d83886f56 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -1,41 +1,51 @@ -" Vim filetype plugin file -" Language: man -" Maintainer: SungHyun Nam <goweol@gmail.com> +" Maintainer: Anmol Sethi <anmol@aubble.com> +" Previous Maintainer: SungHyun Nam <goweol@gmail.com> -if has('vim_starting') && &filetype !=# 'man' - finish -endif - -" Only do this when not done yet for this buffer -if exists('b:did_ftplugin') +if exists('b:did_ftplugin') || &filetype !=# 'man' finish endif let b:did_ftplugin = 1 -" Ensure Vim is not recursively invoked (man-db does this) -" when doing ctrl-[ on a man page reference. -if exists('$MANPAGER') - let $MANPAGER = '' -endif +let s:pager = !exists('b:man_sect') -setlocal iskeyword+=\.,-,(,) - -setlocal buftype=nofile noswapfile -setlocal nomodifiable readonly bufhidden=hide nobuflisted tabstop=8 +if s:pager + call man#init_pager() +endif -if !exists("g:no_plugin_maps") && !exists("g:no_man_maps") - nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count, expand('<cword>'))<CR> - nnoremap <silent> <buffer> <C-T> :call man#pop_page()<CR> - nnoremap <silent> <nowait><buffer> q <C-W>c - if &keywordprg !=# ':Man' - nnoremap <silent> <buffer> K :call man#get_page(v:count, expand('<cword>'))<CR> +setlocal buftype=nofile +setlocal noswapfile +setlocal bufhidden=hide +setlocal nomodified +setlocal readonly +setlocal nomodifiable +setlocal noexpandtab +setlocal tabstop=8 +setlocal softtabstop=8 +setlocal shiftwidth=8 + +setlocal nonumber +setlocal norelativenumber +setlocal foldcolumn=0 +setlocal colorcolumn=0 +setlocal nolist +setlocal nofoldenable + +if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') + nnoremap <silent> <buffer> <C-]> :Man<CR> + nnoremap <silent> <buffer> K :Man<CR> + nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR> + if s:pager + nnoremap <silent> <buffer> <nowait> q :q<CR> + else + nnoremap <silent> <buffer> <nowait> q <C-W>c endif endif -if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1) - setlocal foldmethod=indent foldnestmax=1 foldenable +if get(g:, 'ft_man_folding_enable', 0) + setlocal foldenable + setlocal foldmethod=indent + setlocal foldnestmax=1 endif -let b:undo_ftplugin = 'setlocal iskeyword<' - +let b:undo_ftplugin = '' " vim: set sw=2: diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 75c7e87996..df5dab8afc 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -1,8 +1,9 @@ " Vim filetype plugin file " Language: python -" Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: 2014 Feb 09 -" Last Change By Johannes: Wed, 21 Apr 2004 13:13:08 CEST +" Maintainer: James Sully <sullyj3@gmail.com> +" Previous Maintainer: Johannes Zellner <johannes@zellner.org> +" Last Change: Wed, 29 June 2016 +" https://github.com/sullyj3/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -21,28 +22,38 @@ setlocal omnifunc=pythoncomplete#Complete set wildignore+=*.pyc -nnoremap <silent> <buffer> ]] :call <SID>Python_jump('/^\(class\\|def\)')<cr> -nnoremap <silent> <buffer> [[ :call <SID>Python_jump('?^\(class\\|def\)')<cr> -nnoremap <silent> <buffer> ]m :call <SID>Python_jump('/^\s*\(class\\|def\)')<cr> -nnoremap <silent> <buffer> [m :call <SID>Python_jump('?^\s*\(class\\|def\)')<cr> +nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '\v%$\|^(class\|def)>', 'W')<cr> +nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '\v^(class\|def)>', 'Wb')<cr> +nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '\v%$\|^\s*(class\|def)>', 'W')<cr> +nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '\v^\s*(class\|def)>', 'Wb')<cr> + +xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '\v%$\|^(class\|def)>', 'W')<cr> +xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '\v^(class\|def)>', 'Wb')<cr> +xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '\v%$\|^\s*(class\|def)>', 'W')<cr> +xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '\v^\s*(class\|def)>', 'Wb')<cr> if !exists('*<SID>Python_jump') - fun! <SID>Python_jump(motion) range + fun! <SID>Python_jump(mode, motion, flags) range + if a:mode == 'x' + normal! gv + endif + + normal! 0 + let cnt = v:count1 - let save = @/ " save last search pattern mark ' while cnt > 0 - silent! exe a:motion - let cnt = cnt - 1 + call search(a:motion, a:flags) + let cnt = cnt - 1 endwhile - call histdel('/', -1) - let @/ = save " restore last search pattern + + normal! ^ endfun endif if has("browsefilter") && !exists("b:browsefilter") let b:browsefilter = "Python Files (*.py)\t*.py\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" endif " As suggested by PEP8. diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index 43b208b842..4ea3073922 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Sun Feb 23, 2014 04:07PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index 9b72fb42f9..fdac38f3e9 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R help file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 55723ff396..ec64a07675 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: R help file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index baf53d0108..e184399dcb 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Rnoweb " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:37PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index 8140169e61..ecfd6e87a1 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: reStructuredText documentation format with R code " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 06:23PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Original work by Alex Zvoleff " Only do this when not yet done for this buffer diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim index 6d5bf4b806..2a961f8244 100644 --- a/runtime/ftplugin/spec.vim +++ b/runtime/ftplugin/spec.vim @@ -36,10 +36,11 @@ except ImportError: else: specfile = vim.current.buffer.name if specfile: + rpm.delMacro("dist") spec = rpm.spec(specfile) - headers = spec.packages[0].header - version = headers['Version'] - release = ".".join(headers['Release'].split(".")[:-1]) + headers = spec.sourceHeader + version = headers["Version"] + release = headers["Release"] vim.command("let ver = " + version) vim.command("let rel = " + release) PYEND @@ -113,7 +114,10 @@ if !exists("*s:SpecChangelog") endif endif if (chgline != -1) + let tmptime = v:lc_time + language time C let parsed_format = "* ".strftime(format)." - ".ver."-".rel + execute "language time" tmptime let release_info = "+ ".name."-".ver."-".rel let wrong_format = 0 let wrong_release = 0 @@ -179,12 +183,8 @@ if !exists("*s:ParseRpmVars") endif let varname = strpart(a:str, start+2, end-(start+2)) execute a:strline - let definestr = "^[ \t]*%define[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$" + let definestr = "^[ \t]*%(?:global|define)[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$" let linenum = search(definestr, "bW") - if (linenum == 0) - let definestr = substitute(definestr, "%define", "%global", "") - let linenum = search(definestr, "bW") - endif if (linenum != -1) let ret = ret . substitute(getline(linenum), definestr, "\\1", "") else @@ -201,7 +201,7 @@ endif let b:match_ignorecase = 0 let b:match_words = - \ '^Name:^%description:^%clean:^%setup:^%build:^%install:^%files:' . + \ '^Name:^%description:^%clean:^%(?:auto)?setup:^%build:^%install:^%files:' . \ '^%package:^%preun:^%postun:^%changelog' let &cpo = s:cpo_save diff --git a/runtime/indent/clojure.vim b/runtime/indent/clojure.vim index 476ac1de1c..7592b10d7d 100644 --- a/runtime/indent/clojure.vim +++ b/runtime/indent/clojure.vim @@ -1,17 +1,12 @@ " Vim indent file -" Language: Clojure -" Author: Meikel Brandmeyer <mb@kotka.de> -" URL: http://kotka.de/projects/clojure/vimclojure.html +" Language: Clojure +" Author: Meikel Brandmeyer <mb@kotka.de> +" URL: http://kotka.de/projects/clojure/vimclojure.html " -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 - -" TODO: Indenting after multibyte characters is broken: -" (let [Δ (if foo -" bar ; Indent error -" baz)]) +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 if exists("b:did_indent") finish @@ -57,36 +52,39 @@ if exists("*searchpairpos") let g:clojure_align_subforms = 0 endif - function! s:SynIdName() + function! s:syn_id_name() return synIDattr(synID(line("."), col("."), 0), "name") endfunction - function! s:CurrentChar() + function! s:ignored_region() + return s:syn_id_name() =~? '\vstring|regex|comment|character' + endfunction + + function! s:current_char() return getline('.')[col('.')-1] endfunction - function! s:CurrentWord() + function! s:current_word() return getline('.')[col('.')-1 : searchpos('\v>', 'n', line('.'))[1]-2] endfunction - function! s:IsParen() - return s:CurrentChar() =~# '\v[\(\)\[\]\{\}]' && - \ s:SynIdName() !~? '\vstring|regex|comment|character' + function! s:is_paren() + return s:current_char() =~# '\v[\(\)\[\]\{\}]' && !s:ignored_region() endfunction " Returns 1 if string matches a pattern in 'patterns', which may be a " list of patterns, or a comma-delimited string of implicitly anchored " patterns. - function! s:MatchesOne(patterns, string) + function! s:match_one(patterns, string) let list = type(a:patterns) == type([]) - \ ? a:patterns - \ : map(split(a:patterns, ','), '"^" . v:val . "$"') + \ ? a:patterns + \ : map(split(a:patterns, ','), '"^" . v:val . "$"') for pat in list if a:string =~# pat | return 1 | endif endfor endfunction - function! s:MatchPairs(open, close, stopat) + function! s:match_pairs(open, close, stopat) " Stop only on vector and map [ resp. {. Ignore the ones in strings and " comments. if a:stopat == 0 @@ -95,11 +93,11 @@ if exists("*searchpairpos") let stopat = a:stopat endif - let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:IsParen()", stopat) - return [pos[0], virtcol(pos)] + let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:is_paren()", stopat) + return [pos[0], col(pos)] endfunction - function! s:ClojureCheckForStringWorker() + function! s:clojure_check_for_string_worker() " Check whether there is the last character of the previous line is " highlighted as a string. If so, we check whether it's a ". In this " case we have to check also the previous character. The " might be the @@ -113,17 +111,17 @@ if exists("*searchpairpos") call cursor(nb, 0) call cursor(0, col("$") - 1) - if s:SynIdName() !~? "string" + if s:syn_id_name() !~? "string" return -1 endif " This will not work for a " in the first column... - if s:CurrentChar() == '"' + if s:current_char() == '"' call cursor(0, col("$") - 2) - if s:SynIdName() !~? "string" + if s:syn_id_name() !~? "string" return -1 endif - if s:CurrentChar() != '\\' + if s:current_char() != '\\' return -1 endif call cursor(0, col("$") - 1) @@ -138,40 +136,40 @@ if exists("*searchpairpos") return indent(".") endfunction - function! s:CheckForString() + function! s:check_for_string() let pos = getpos('.') try - let val = s:ClojureCheckForStringWorker() + let val = s:clojure_check_for_string_worker() finally call setpos('.', pos) endtry return val endfunction - function! s:StripNamespaceAndMacroChars(word) + function! s:strip_namespace_and_macro_chars(word) return substitute(a:word, "\\v%(.*/|[#'`~@^,]*)(.*)", '\1', '') endfunction - function! s:ClojureIsMethodSpecialCaseWorker(position) + function! s:clojure_is_method_special_case_worker(position) " Find the next enclosing form. call search('\S', 'Wb') " Special case: we are at a '(('. - if s:CurrentChar() == '(' + if s:current_char() == '(' return 0 endif call cursor(a:position) - let nextParen = s:MatchPairs('(', ')', 0) + let next_paren = s:match_pairs('(', ')', 0) " Special case: we are now at toplevel. - if nextParen == [0, 0] + if next_paren == [0, 0] return 0 endif - call cursor(nextParen) + call cursor(next_paren) call search('\S', 'W') - let w = s:StripNamespaceAndMacroChars(s:CurrentWord()) + let w = s:strip_namespace_and_macro_chars(s:current_word()) if g:clojure_special_indent_words =~# '\V\<' . w . '\>' return 1 endif @@ -179,27 +177,43 @@ if exists("*searchpairpos") return 0 endfunction - function! s:IsMethodSpecialCase(position) + function! s:is_method_special_case(position) let pos = getpos('.') try - let val = s:ClojureIsMethodSpecialCaseWorker(a:position) + let val = s:clojure_is_method_special_case_worker(a:position) finally call setpos('.', pos) endtry return val endfunction - function! GetClojureIndent() + " Check if form is a reader conditional, that is, it is prefixed by #? + " or @#? + function! s:is_reader_conditional_special_case(position) + if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?" + return 1 + endif + + return 0 + endfunction + + " Returns 1 for opening brackets, -1 for _anything else_. + function! s:bracket_type(char) + return stridx('([{', a:char) > -1 ? 1 : -1 + endfunction + + " Returns: [opening-bracket-lnum, indent] + function! s:clojure_indent_pos() " Get rid of special case. if line(".") == 1 - return 0 + return [0, 0] endif " We have to apply some heuristics here to figure out, whether to use " normal lisp indenting or not. - let i = s:CheckForString() + let i = s:check_for_string() if i > -1 - return i + !!g:clojure_align_multiline_strings + return [0, i + !!g:clojure_align_multiline_strings] endif call cursor(0, 1) @@ -207,28 +221,28 @@ if exists("*searchpairpos") " Find the next enclosing [ or {. We can limit the second search " to the line, where the [ was found. If no [ was there this is " zero and we search for an enclosing {. - let paren = s:MatchPairs('(', ')', 0) - let bracket = s:MatchPairs('\[', '\]', paren[0]) - let curly = s:MatchPairs('{', '}', bracket[0]) + let paren = s:match_pairs('(', ')', 0) + let bracket = s:match_pairs('\[', '\]', paren[0]) + let curly = s:match_pairs('{', '}', bracket[0]) " In case the curly brace is on a line later then the [ or - in " case they are on the same line - in a higher column, we take the " curly indent. if curly[0] > bracket[0] || curly[1] > bracket[1] if curly[0] > paren[0] || curly[1] > paren[1] - return curly[1] + return curly endif endif " If the curly was not chosen, we take the bracket indent - if " there was one. if bracket[0] > paren[0] || bracket[1] > paren[1] - return bracket[1] + return bracket endif " There are neither { nor [ nor (, ie. we are at the toplevel. if paren == [0, 0] - return 0 + return paren endif " Now we have to reimplement lispindent. This is surprisingly easy, as @@ -246,58 +260,120 @@ if exists("*searchpairpos") " - In any other case we use the column of the end of the word + 2. call cursor(paren) - if s:IsMethodSpecialCase(paren) - return paren[1] + &shiftwidth - 1 + if s:is_method_special_case(paren) + return [paren[0], paren[1] + &shiftwidth - 1] + endif + + if s:is_reader_conditional_special_case(paren) + return paren endif " In case we are at the last character, we use the paren position. if col("$") - 1 == paren[1] - return paren[1] + return paren endif " In case after the paren is a whitespace, we search for the next word. call cursor(0, col('.') + 1) - if s:CurrentChar() == ' ' + if s:current_char() == ' ' call search('\v\S', 'W') endif " If we moved to another line, there is no word after the (. We " use the ( position for indent. if line(".") > paren[0] - return paren[1] + return paren endif " We still have to check, whether the keyword starts with a (, [ or {. " In that case we use the ( position for indent. - let w = s:CurrentWord() - if stridx('([{', w[0]) > -1 - return paren[1] + let w = s:current_word() + if s:bracket_type(w[0]) == 1 + return paren endif " Test words without namespace qualifiers and leading reader macro " metacharacters. " " e.g. clojure.core/defn and #'defn should both indent like defn. - let ww = s:StripNamespaceAndMacroChars(w) + let ww = s:strip_namespace_and_macro_chars(w) if &lispwords =~# '\V\<' . ww . '\>' - return paren[1] + &shiftwidth - 1 + return [paren[0], paren[1] + &shiftwidth - 1] endif if g:clojure_fuzzy_indent - \ && !s:MatchesOne(g:clojure_fuzzy_indent_blacklist, ww) - \ && s:MatchesOne(g:clojure_fuzzy_indent_patterns, ww) - return paren[1] + &shiftwidth - 1 + \ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww) + \ && s:match_one(g:clojure_fuzzy_indent_patterns, ww) + return [paren[0], paren[1] + &shiftwidth - 1] endif call search('\v\_s', 'cW') call search('\v\S', 'W') if paren[0] < line(".") - return paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1) + return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)] endif call search('\v\S', 'bW') - return virtcol(".") + 1 + return [line('.'), col('.') + 1] + endfunction + + function! GetClojureIndent() + let lnum = line('.') + let orig_lnum = lnum + let orig_col = col('.') + let [opening_lnum, indent] = s:clojure_indent_pos() + + " Account for multibyte characters + if opening_lnum > 0 + let indent -= indent - virtcol([opening_lnum, indent]) + endif + + " Return if there are no previous lines to inherit from + if opening_lnum < 1 || opening_lnum >= lnum - 1 + call cursor(orig_lnum, orig_col) + return indent + endif + + let bracket_count = 0 + + " Take the indent of the first previous non-white line that is + " at the same sexp level. cf. src/misc1.c:get_lisp_indent() + while 1 + let lnum = prevnonblank(lnum - 1) + let col = 1 + + if lnum <= opening_lnum + break + endif + + call cursor(lnum, col) + + " Handle bracket counting edge case + if s:is_paren() + let bracket_count += s:bracket_type(s:current_char()) + endif + + while 1 + if search('\v[(\[{}\])]', '', lnum) < 1 + break + elseif !s:ignored_region() + let bracket_count += s:bracket_type(s:current_char()) + endif + endwhile + + if bracket_count == 0 + " Check if this is part of a multiline string + call cursor(lnum, 1) + if s:syn_id_name() !~? '\vstring|regex' + call cursor(orig_lnum, orig_col) + return indent(lnum) + endif + endif + endwhile + + call cursor(orig_lnum, orig_col) + return indent endfunction setlocal indentexpr=GetClojureIndent() diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim index d492889fc7..e19a19fb1f 100644 --- a/runtime/indent/fortran.vim +++ b/runtime/indent/fortran.vim @@ -1,11 +1,11 @@ " Vim indent file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) -" Version: 0.42 -" Last Change: 2015 Nov. 30 +" Version: 0.44 +" Last Change: 2016 Jan. 26 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> " Usage: For instructions, do :help fortran-indent from Vim " Credits: -" Useful suggestions were made by: Albert Oliver Serra. +" Useful suggestions were made by: Albert Oliver Serra and Takuya Fujiwara. " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -92,10 +92,10 @@ function FortranGetIndent(lnum) "Indent do loops only if they are all guaranteed to be of do/end do type if exists("b:fortran_do_enddo") || exists("g:fortran_do_enddo") if prevstat =~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*do\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*end\s*do\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif @@ -105,14 +105,14 @@ function FortranGetIndent(lnum) \ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>' \ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>' \ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>' - let ind = ind + &sw + let ind = ind + shiftwidth() " Remove unwanted indent after logical and arithmetic ifs if prevstat =~? '\<if\>' && prevstat !~? '\<then\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Remove unwanted indent after type( statements if prevstat =~? '^\s*type\s*(' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif @@ -125,12 +125,12 @@ function FortranGetIndent(lnum) \ ||prevstat =~? '^\s*'.prefix.'subroutine\>' \ ||prevstat =~? '^\s*'.prefix.type.'function\>' \ ||prevstat =~? '^\s*'.type.prefix.'function\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*contains\>' \ ||getline(v:lnum)=~? '^\s*end\s*' \ .'\(function\|subroutine\|module\|program\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif @@ -141,23 +141,23 @@ function FortranGetIndent(lnum) \. '\(else\|else\s*if\|else\s*where\|case\|' \. 'end\s*\(if\|where\|select\|interface\|' \. 'type\|forall\|associate\|enum\|block\)\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() " Fix indent for case statement immediately after select if prevstat =~? '\<select\s\+\(case\|type\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif "First continuation line if prevstat =~ '&\s*$' && prev2stat !~ '&\s*$' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if prevstat =~ '&\s*$' && prevstat =~ '\<else\s*if\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif "Line after last continuation line if prevstat !~ '&\s*$' && prev2stat =~ '&\s*$' && prevstat !~? '\<then\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 8aaf82e21f..828bc3120b 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula <anwoku@yahoo.de> -" Last Change: 2015 Sep 25 +" Last Change: 2016 Mar 30 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -240,13 +240,13 @@ call s:AddITags(s:indent_tags, [ \ 'sup', 'table', 'textarea', 'title', 'tt', 'u', 'ul', 'var', 'th', 'td', \ 'tr', 'tbody', 'tfoot', 'thead']) -" Tags added 2011 Sep 09 (especially HTML5 tags): +" New HTML5 elements: call s:AddITags(s:indent_tags, [ \ 'area', 'article', 'aside', 'audio', 'bdi', 'canvas', - \ 'command', 'datalist', 'details', 'embed', 'figure', 'footer', - \ 'header', 'group', 'keygen', 'mark', 'math', 'meter', 'nav', 'output', - \ 'progress', 'ruby', 'section', 'svg', 'texture', 'time', 'video', - \ 'wbr', 'text']) + \ 'command', 'data', 'datalist', 'details', 'embed', 'figcaption', + \ 'figure', 'footer', 'header', 'keygen', 'mark', 'meter', 'nav', 'output', + \ 'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary', 'svg', + \ 'time', 'track', 'video', 'wbr']) " Tags added for web components: call s:AddITags(s:indent_tags, [ diff --git a/runtime/indent/javascript.vim b/runtime/indent/javascript.vim index 21c8fff86c..3507e305ed 100644 --- a/runtime/indent/javascript.vim +++ b/runtime/indent/javascript.vim @@ -1,18 +1,192 @@ " Vim indent file -" Language: Javascript -" Maintainer: Going to be Darrick Wiebe -" Last Change: 2015 Jun 09 +" Language: Javascript +" Maintainer: vim-javascript community +" URL: https://github.com/pangloss/vim-javascript +" Last Change: August 12, 2016 " Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish +if exists('b:did_indent') + finish endif let b:did_indent = 1 -" C indenting is not too bad. -setlocal cindent +" Now, set up our indentation expression and keys that trigger it. +setlocal indentexpr=GetJavascriptIndent() +setlocal nolisp +setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e setlocal cinoptions+=j1,J1 -setlocal cinkeys-=0# -setlocal cinkeys+=0] -let b:undo_indent = "setl cin<" +let b:undo_indent = 'setlocal indentexpr< indentkeys< cinoptions<' + +" Only define the function once. +if exists('*GetJavascriptIndent') + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Get shiftwidth value +if exists('*shiftwidth') + function s:sw() + return shiftwidth() + endfunction +else + function s:sw() + return &sw + endfunction +endif + +let s:line_pre = '^\s*\%(\/\*.\{-}\*\/\s*\)*' +let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:' +" Regex of syntax group names that are or delimit string or are comments. +let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)' + +" Regex of syntax group names that are strings or documentation. +let s:syng_comment = '\%(comment\|doc\)' + +" Expression used to check whether we should skip a match with searchpair(). +let s:skip_expr = "line('.') < (prevnonblank(v:lnum) - 2000) ? dummy : synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'" + +function s:lookForParens(start,end,flags,time) + if has('reltime') + return searchpair(a:start,'',a:end,a:flags,s:skip_expr,0,a:time) + else + return searchpair(a:start,'',a:end,a:flags,0,0) + endif +endfunction + +let s:line_term = '\%(\s*\%(\/\*.\{-}\*\/\s*\)\=\)\@>$' + +" configurable regexes that define continuation lines, not including (, {, or [. +if !exists('g:javascript_opfirst') + let g:javascript_opfirst = '\%([<>,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)' +endif +let g:javascript_opfirst = s:line_pre . g:javascript_opfirst + +if !exists('g:javascript_continuation') + let g:javascript_continuation = '\%([<*,.?:^%]\|+\@<!+\|-\@<!-\|=\@<!>\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)' +endif +let g:javascript_continuation .= s:line_term + +function s:Onescope(lnum,text,add) + return a:text =~# '\%(\<else\|\<do\|=>' . (a:add ? '\|\<try\|\<finally' : '' ) . '\)' . s:line_term || + \ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) || + \ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) && + \ s:lookForParens('(', ')', 'cbW', 100) > 0 && search((a:add ? + \ '\%(function\*\|[[:lower:][:upper:]_$][[:digit:][:lower:][:upper:]_$]*\)' : + \ '\<\%(for\%(\s\+each\)\=\|if\|let\|w\%(hile\|ith\)\)') . '\_s*\%#\C','bW') && + \ (a:add || (expand('<cword>') ==# 'while' ? !s:lookForParens('\<do\>\C', '\<while\>\C','bW',100) : 1)) +endfunction + +" Auxiliary Functions {{{2 + +" strip line of comment +function s:StripLine(c) + return a:c !~# s:expr_case ? substitute(a:c, '\%(:\@<!\/\/.*\)$', '','') : a:c +endfunction + +" Find line above 'lnum' that isn't empty, in a comment, or in a string. +function s:PrevCodeLine(lnum) + let l:lnum = prevnonblank(a:lnum) + while l:lnum > 0 + if synIDattr(synID(l:lnum,matchend(getline(l:lnum), '^\s*[^''"]'),0),'name') !~? s:syng_strcom + break + endif + let l:lnum = prevnonblank(l:lnum - 1) + endwhile + return l:lnum +endfunction + +" Check if line 'lnum' has a balanced amount of parentheses. +function s:Balanced(lnum) + let open_0 = 0 + let open_2 = 0 + let open_4 = 0 + let l:line = getline(a:lnum) + let pos = match(l:line, '[][(){}]', 0) + while pos != -1 + if synIDattr(synID(a:lnum,pos + 1,0),'name') !~? s:syng_strcom + let idx = stridx('(){}[]', l:line[pos]) + if idx % 2 == 0 + let open_{idx} = open_{idx} + 1 + else + let open_{idx - 1} = open_{idx - 1} - 1 + endif + endif + let pos = match(l:line, '[][(){}]', pos + 1) + endwhile + return (!open_4 + !open_2 + !open_0) - 2 +endfunction +" }}} + +function GetJavascriptIndent() + if !exists('b:js_cache') + let b:js_cache = [0,0,0] + endif + " Get the current line. + let l:line = getline(v:lnum) + let syns = synIDattr(synID(v:lnum, 1, 0), 'name') + + " start with strings,comments,etc.{{{2 + if (l:line !~ '^[''"`]' && syns =~? 'string\|template') || + \ (l:line !~ '^\s*[/*]' && syns =~? s:syng_comment) + return -1 + endif + if l:line !~ '^\%(\/\*\|\s*\/\/\)' && syns =~? s:syng_comment + return cindent(v:lnum) + endif + let l:lnum = s:PrevCodeLine(v:lnum - 1) + if l:lnum == 0 + return 0 + endif + + if (l:line =~# s:expr_case) + let cpo_switch = &cpo + set cpo+=% + let ind = cindent(v:lnum) + let &cpo = cpo_switch + return ind + endif + "}}} + + " the containing paren, bracket, curly. Memoize, last lineNr either has the + " same scope or starts a new one, unless if it closed a scope. + call cursor(v:lnum,1) + if b:js_cache[0] >= l:lnum && b:js_cache[0] <= v:lnum && b:js_cache[0] && + \ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum) > 0) + let num = b:js_cache[1] + elseif syns != '' && l:line[0] =~ '\s' + let pattern = syns =~? 'block' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] : + \ syns =~? 'jsbracket'? ['\[','\]'] : ['[({[]','[])}]'] + let num = s:lookForParens(pattern[0],pattern[1],'bW',2000) + else + let num = s:lookForParens('[({[]','[])}]','bW',2000) + endif + let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')] + + if l:line =~ s:line_pre . '[])}]' + return indent(num) + endif + + let pline = s:StripLine(getline(l:lnum)) + let inb = num == 0 ? 1 : (s:Onescope(num, s:StripLine(strpart(getline(num),0,b:js_cache[2] - 1)),1) || + \ (l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term)) && num < l:lnum + let switch_offset = (!inb || num == 0) || expand("<cword>") !=# 'switch' ? 0 : &cino !~ ':' || !has('float') ? s:sw() : + \ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1)) + + " most significant, find the indent amount + if (inb && (l:line =~# g:javascript_opfirst || + \ (pline =~# g:javascript_continuation && pline !~# s:expr_case && (pline !~ ':' . s:line_term || l:line !~# + \ s:line_pre . '\%(d\%(o\|ebugger\)\|else\|f\%(or\|inally\)\|if\|let\|switch\|t\%(hrow\|ry\)\|w\%(hile\|ith\)\)\>')))) || + \ (num < l:lnum && s:Onescope(l:lnum,pline,0) && l:line !~ s:line_pre . '{') + return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset + elseif num > 0 + return indent(num) + s:sw() + switch_offset + endif + +endfunction + + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index 393994c590..d1d2c0d600 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -2,7 +2,7 @@ " Language: Lua script " Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br> " First Author: Max Ischenko <mfi 'at' ukr.net> -" Last Change: 2014 Nov 12 +" Last Change: 2016 Jan 10 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -52,7 +52,7 @@ function! GetLuaIndent() endif endif - " Subtract a 'shiftwidth' on end, else (and elseif), until and '}' + " Subtract a 'shiftwidth' on end, else, elseif, until and '}' " This is the part that requires 'indentkeys'. let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)') if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment" diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 1bffa7f195..07ecd8f141 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -3,8 +3,8 @@ " Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr> " URL: http://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm -" Last Change: 2014 November 26th -" Version: 1.57 +" Last Change: 2015 September 8th +" Version: 1.60 " " " Type :help php-indent for available options @@ -50,16 +50,25 @@ let b:did_indent = 1 let g:php_sync_method = 0 +if exists('*shiftwidth') + function! s:sw() + return shiftwidth() + endfunction +else + function! s:sw() + return &shiftwidth + endfunction +endif if exists("PHP_default_indenting") - let b:PHP_default_indenting = PHP_default_indenting * &sw + let b:PHP_default_indenting = PHP_default_indenting * s:sw() else let b:PHP_default_indenting = 0 endif if exists("PHP_outdentSLComments") - let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw + let b:PHP_outdentSLComments = PHP_outdentSLComments * s:sw() else let b:PHP_outdentSLComments = 0 endif @@ -124,7 +133,7 @@ endif if exists("*GetPhpIndent") call ResetPhpOptions() - finish " XXX -- comment this line for easy dev + finish endif @@ -135,7 +144,7 @@ let s:functionDecl = '\<function\>\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*' let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' -let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$' +let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$' let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!' @@ -200,7 +209,7 @@ function! GetLastRealCodeLNum(startline) " {{{ elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc - let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '') + let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<\\s*[''"]\\=\1[''"]\\=$', '') while getline(lnum) !~? tofind && lnum > 1 let lnum = lnum - 1 endwhile @@ -314,7 +323,7 @@ function! FindTheSwitchIndent (lnum) " {{{ let test = GetLastRealCodeLNum(a:lnum - 1) if test <= 1 - return indent(1) - &sw * b:PHP_vintage_case_default_indent + return indent(1) - s:sw() * b:PHP_vintage_case_default_indent end while getline(test) =~ '^\s*}' && test > 1 @@ -328,7 +337,7 @@ function! FindTheSwitchIndent (lnum) " {{{ if getline(test) =~# '^\s*switch\>' return indent(test) elseif getline(test) =~# s:defaultORcase - return indent(test) - &sw * b:PHP_vintage_case_default_indent + return indent(test) - s:sw() * b:PHP_vintage_case_default_indent else return FindTheSwitchIndent(test) endif @@ -401,7 +410,7 @@ function! GetPhpIndent() endif if b:PHP_default_indenting - let b:PHP_default_indenting = g:PHP_default_indenting * &sw + let b:PHP_default_indenting = g:PHP_default_indenting * s:sw() endif let cline = getline(v:lnum) @@ -439,6 +448,7 @@ function! GetPhpIndent() if !b:InPHPcode_checked " {{{ One time check let b:InPHPcode_checked = 1 + let b:UserIsTypingComment = 0 let synname = "" if cline !~ '<?.*?>' @@ -447,8 +457,7 @@ function! GetPhpIndent() if synname!="" if synname == "SpecStringEntrails" - let b:InPHPcode = -1 " thumb down - let b:UserIsTypingComment = 0 + let b:InPHPcode = -1 let b:InPHPcode_tofind = "" elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter" let b:InPHPcode = 1 @@ -456,8 +465,7 @@ function! GetPhpIndent() if synname =~# '^php\%(Doc\)\?Comment' let b:UserIsTypingComment = 1 - else - let b:UserIsTypingComment = 0 + let b:InPHPcode_checked = 0 endif if synname =~? '^javaScript' @@ -466,18 +474,16 @@ function! GetPhpIndent() else let b:InPHPcode = 0 - let b:UserIsTypingComment = 0 let lnum = v:lnum - 1 - while getline(lnum) !~? '<<<''\=\a\w*''\=$' && lnum > 1 + while getline(lnum) !~? '<<<\s*[''"]\=\a\w*[''"]\=$' && lnum > 1 let lnum = lnum - 1 endwhile - let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') + let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '') endif else let b:InPHPcode = 0 - let b:UserIsTypingComment = 0 let b:InPHPcode_tofind = s:PHP_startindenttag endif endif "!b:InPHPcode_checked }}} @@ -537,9 +543,9 @@ function! GetPhpIndent() elseif last_line =~ '^[^''"`]\+[''"`]$' let b:InPHPcode = -1 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') - elseif last_line =~? '<<<''\=\a\w*''\=$' + elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$' let b:InPHPcode = 0 - let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '') + let b:InPHPcode_tofind = substitute( last_line, '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '') elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*' let b:InPHPcode = 0 @@ -660,7 +666,7 @@ function! GetPhpIndent() let b:PHP_CurrentIndentLevel = b:PHP_default_indenting return indent(FindTheIfOfAnElse(v:lnum, 1)) elseif cline =~# s:defaultORcase - return FindTheSwitchIndent(v:lnum) + &sw * b:PHP_vintage_case_default_indent + return FindTheSwitchIndent(v:lnum) + s:sw() * b:PHP_vintage_case_default_indent elseif cline =~ '^\s*)\=\s*{' let previous_line = last_line let last_line_num = lnum @@ -672,7 +678,7 @@ function! GetPhpIndent() let ind = indent(last_line_num) if b:PHP_BracesAtCodeLevel - let ind = ind + &sw + let ind = ind + s:sw() endif return ind @@ -683,7 +689,7 @@ function! GetPhpIndent() endwhile elseif last_line =~# unstated && cline !~ '^\s*);\='.endline - let ind = ind + &sw + let ind = ind + s:sw() return ind + addSpecial elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated @@ -782,7 +788,7 @@ function! GetPhpIndent() endif if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{') - let ind = ind + &sw + let ind = ind + s:sw() endif if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1 @@ -800,17 +806,17 @@ function! GetPhpIndent() endif elseif last_line =~ '^\s*'.s:blockstart - let ind = ind + &sw + let ind = ind + s:sw() elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase - let ind = ind + &sw + let ind = ind + s:sw() endif endif if cline =~ '^\s*[)\]];\=' - let ind = ind - &sw + let ind = ind - s:sw() endif let b:PHP_CurrentIndentLevel = ind diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 105f0cd7ad..01f3812ed2 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: R " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Thu Mar 26, 2015 05:36PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Thu Feb 18, 2016 06:32AM " Only load this indent file when no other was loaded. @@ -32,7 +33,7 @@ if ! exists("g:r_indent_ess_compatible") let g:r_indent_ess_compatible = 0 endif if ! exists("g:r_indent_op_pattern") - let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%\)$' + let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$' endif function s:RDelete_quotes(line) @@ -265,7 +266,7 @@ function GetRIndent() return 0 endif - if cline =~ '^\s*{' + if cline =~ '^\s*{' && s:Get_paren_balance(cline, '{', '}') > 0 if g:r_indent_ess_compatible && line =~ ')$' let nlnum = lnum let nline = line @@ -283,7 +284,7 @@ function GetRIndent() endif " line is an incomplete command: - if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' + if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$' return indent(lnum) + &sw endif @@ -344,7 +345,7 @@ function GetRIndent() endif let post_block = 0 - if line =~ '}$' + if line =~ '}$' && s:Get_paren_balance(line, '{', '}') < 0 let lnum = s:Get_matching_brace(lnum, '{', '}', 0) let line = SanitizeRLine(getline(lnum)) if lnum > 0 && line =~ '^\s*{' @@ -359,14 +360,14 @@ function GetRIndent() let olnum = s:Get_prev_line(lnum) let oline = getline(olnum) if olnum > 0 - if line =~ g:r_indent_op_pattern - if oline =~ g:r_indent_op_pattern + if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 + if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) else return indent(lnum) + &sw endif else - if oline =~ g:r_indent_op_pattern + if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) - &sw endif endif @@ -471,7 +472,6 @@ function GetRIndent() endif let ind = indent(lnum) - let pind = indent(plnum) if g:r_indent_align_args == 0 && pb != 0 let ind += pb * &sw @@ -483,6 +483,12 @@ function GetRIndent() return ind endif + if plnum > 0 + let pind = indent(plnum) + else + let pind = 0 + endif + if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0) return ind endif diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim index 3b37128b2c..9dc2031cb6 100644 --- a/runtime/indent/rhelp.vim +++ b/runtime/indent/rhelp.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: R Documentation (Help), *.Rd " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Thu Oct 16, 2014 07:07AM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 9a8a3cb719..88904405e8 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rmd " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Thu Jul 10, 2014 07:11PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim index d0cad3d8d9..29fa5bc78f 100644 --- a/runtime/indent/rnoweb.vim +++ b/runtime/indent/rnoweb.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rnoweb " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Sun Mar 22, 2015 09:28AM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim index 8bfa8344ce..f3ee53e7fb 100644 --- a/runtime/indent/rrst.vim +++ b/runtime/indent/rrst.vim @@ -1,7 +1,8 @@ " Vim indent file " Language: Rrst " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> -" Last Change: Wed Jul 09, 2014 07:33PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Tue Apr 07, 2015 04:38PM " Only load this indent file when no other was loaded. diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index 5bd8c77fab..aca110f504 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -3,23 +3,29 @@ " Maintainer: Christian Brabandt <cb@256bit.org> " Previous Maintainer: Peter Aronoff <telemachus@arpinum.org> " Original Author: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2015-12-15 +" Latest Revision: 2016-06-27 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent +" Changelog: +" 20160627: - detect heredocs correctly +" 20160213: - detect function definition correctly +" 20160202: - use shiftwidth() function +" 20151215: - set b:undo_indent variable +" 20150728: - add foreach detection for zsh if exists("b:did_indent") finish endif let b:did_indent = 1 -let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' - setlocal indentexpr=GetShIndent() setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;& setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix setlocal indentkeys-=:,0# setlocal nosmartindent +let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' + if exists("*GetShIndent") finish endif @@ -28,7 +34,7 @@ let s:cpo_save = &cpo set cpo&vim function s:buffer_shiftwidth() - return &shiftwidth + return shiftwidth() endfunction let s:sh_indent_defaults = { @@ -67,7 +73,7 @@ function! GetShIndent() if !s:is_case_ended(line) let ind += s:indent_value('case-statements') endif - elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{' + elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{' || line =~ '^\s*function\s*\w\S\+\s*\%(()\)\?\s*{' if line !~ '}\s*\%(#.*\)\=$' let ind += s:indent_value('default') endif @@ -102,6 +108,8 @@ function! GetShIndent() endif elseif s:is_case_break(line) let ind -= s:indent_value('case-breaks') + elseif s:is_here_doc(line) + let ind = 0 endif return ind @@ -160,6 +168,14 @@ function! s:is_case_break(line) return a:line =~ '^\s*;[;&]' endfunction +function! s:is_here_doc(line) + if a:line =~ '^\w\+$' + let here_pat = '<<-\?'. s:escape(a:line). '\$' + return search(here_pat, 'bnW') > 0 + endif + return 0 +endfunction + function! s:is_case_ended(line) return s:is_case_break(a:line) || a:line =~ ';[;&]\s*\%(#.*\)\=$' endfunction @@ -172,5 +188,9 @@ function! s:is_case_empty(line) endif endfunction +function! s:escape(pattern) + return '\V'. escape(a:pattern, '\\') +endfunction + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim index 7e3a351083..0150bb9623 100644 --- a/runtime/indent/tex.vim +++ b/runtime/indent/tex.vim @@ -2,10 +2,9 @@ " Language: LaTeX " Maintainer: YiChao Zhou <broken.zhou AT gmail.com> " Created: Sat, 16 Feb 2002 16:50:19 +0100 -" Last Change: 2012 Mar 18 19:19:50 -" Version: 0.7 -" Please email me if you found something we can do. Bug report and -" feature request is welcome. +" Version: 0.9.2 +" Please email me if you found something I can do. Comments, bug report and +" feature request are welcome. " Last Update: {{{ " 25th Sep 2002, by LH : @@ -41,7 +40,7 @@ " (*) Trust user when in "verbatim" and "lstlisting" " 2012/03/11 by Zhou Yichao <broken.zhou AT gmail.com> " (*) Modify "&" so that only indent when current line start with -" "&". +" "&". " 2012/03/12 by Zhou Yichao <broken.zhou AT gmail.com> " (*) Modify indentkeys. " 2012/03/18 by Zhou Yichao <broken.zhou AT gmail.com> @@ -49,6 +48,17 @@ " 2013/05/02 by Zhou Yichao <broken.zhou AT gmail.com> " (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk " for reporting this. +" 2014/06/23 by Zhou Yichao <broken.zhou AT gmail.com> +" (*) Remove the feature g:tex_indent_and because it is buggy. +" (*) If there is not any obvious indentation hints, we do not +" alert our user's current indentation. +" (*) g:tex_indent_brace now only works if the open brace is the +" last character of that line. +" 2014/08/03 by Zhou Yichao <broken.zhou AT gmail.com> +" (*) Indent current line if last line has larger indentation +" 2014/08/09 by Zhou Yichao <broken.zhou AT gmail.com> +" (*) Add missing return value for s:GetEndIndentation(...) +" " }}} " Document: {{{ @@ -60,7 +70,17 @@ " * g:tex_indent_brace " " If this variable is unset or non-zero, it will use smartindent-like style -" for "{}" and "[]" +" for "{}" and "[]". Now this only works if the open brace is the last +" character of that line. +" +" % Example 1 +" \usetikzlibrary{ +" external +" } +" +" % Example 2 +" \tikzexternalize[ +" prefix=tikz] " " * g:tex_indent_items " @@ -98,14 +118,6 @@ " " A list of environment names. separated with '\|', where no indentation is " required. The default is 'document\|verbatim'. -" -" * g:tex_indent_and -" -" If this variable is unset or zero, vim will try to align the line with first -" "&". This is pretty useful when you use environment like table or align. -" Note that this feature need to search back some line, so vim may become -" a little slow. -" " }}} " Only define the function once @@ -126,8 +138,8 @@ endif if !exists("g:tex_indent_brace") let g:tex_indent_brace = 1 endif -if !exists("g:tex_indent_and") - let g:tex_indent_and = 1 +if !exists("g:tex_max_scan_line") + let g:tex_max_scan_line = 60 endif if g:tex_indent_items if !exists("g:tex_itemize_env") @@ -140,10 +152,6 @@ else let g:tex_items = '' endif -if !exists("g:tex_indent_paretheses") - let g:tex_indent_paretheses = 1 -endif - if !exists("g:tex_noindent_env") let g:tex_noindent_env = 'document\|verbatim\|lstlisting' endif "}}} @@ -160,6 +168,7 @@ let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '') function! GetTeXIndent() " {{{ " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) + let cnum = v:lnum " Comment line is not what we need. while lnum != 0 && getline(lnum) =~ '^\s*%' @@ -171,8 +180,8 @@ function! GetTeXIndent() " {{{ return 0 endif - let line = substitute(getline(lnum), '%.*', ' ','g') " last line - let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line + let line = substitute(getline(lnum), '\s*%.*', '','g') " last line + let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line " We are in verbatim, so do what our user what. if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone" @@ -183,26 +192,12 @@ function! GetTeXIndent() " {{{ end endif - " You want to align with "&" - if g:tex_indent_and - " Align only when current line start with "&" - if line =~ '&.*\\\\' && cline =~ '^\s*&' - return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&") - endif - - " set line & lnum to the line which doesn't contain "&" - while lnum != 0 && (stridx(line, "&") != -1 || line =~ '^\s*%') - let lnum = prevnonblank(lnum - 1) - let line = getline(lnum) - endwhile - endif - - if lnum == 0 return 0 endif let ind = indent(lnum) + let stay = 1 " New code for comment: retain the indent of current line if cline =~ '^\s*%' @@ -216,77 +211,197 @@ function! GetTeXIndent() " {{{ " ZYC modification : \end after \begin won't cause wrong indent anymore if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env let ind = ind + &sw + let stay = 0 if g:tex_indent_items " Add another sw for item-environments if line =~ g:tex_itemize_env let ind = ind + &sw + let stay = 0 endif endif endif + if cline =~ '\\end{.*}' + let retn = s:GetEndIndentation(v:lnum) + if retn != -1 + return retn + endif + end " Subtract a 'shiftwidth' when an environment ends - if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env - + if cline =~ '\\end{.*}' + \ && cline !~ g:tex_noindent_env + \ && cline !~ '\\begin{.*}.*\\end{.*}' if g:tex_indent_items " Remove another sw for item-environments if cline =~ g:tex_itemize_env let ind = ind - &sw + let stay = 0 endif endif let ind = ind - &sw + let stay = 0 endif if g:tex_indent_brace - let sum1 = 0 - for i in range(0, strlen(line)-1) - if line[i] == "}" || line[i] == "]" || - \ strpart(line, i, 7) == '\right)' - let sum1 = max([0, sum1-1]) - endif - if line[i] == "{" || line[i] == "[" || - \ strpart(line, i, 6) == '\left(' - let sum1 += 1 - endif - endfor + let char = line[strlen(line)-1] + if char == '[' || char == '{' + let ind += &sw + let stay = 0 + endif - let sum2 = 0 - for i in reverse(range(0, strlen(cline)-1)) - if cline[i] == "{" || cline[i] == "[" || - \ strpart(cline, i, 6) == '\left(' - let sum2 = max([0, sum2-1]) - endif - if cline[i] == "}" || cline[i] == "]" || - \ strpart(cline, i, 7) == '\right)' - let sum2 += 1 + let cind = indent(v:lnum) + let char = cline[cind] + if (char == ']' || char == '}') && + \ s:CheckPairedIsLastCharacter(v:lnum, cind) + let ind -= &sw + let stay = 0 + endif + + for i in range(indent(lnum)+1, strlen(line)-1) + let char = line[i] + if char == ']' || char == '}' + if s:CheckPairedIsLastCharacter(lnum, i) + let ind -= &sw + let stay = 0 + endif endif endfor - - let ind += (sum1 - sum2) * &sw - endif - - if g:tex_indent_paretheses endif " Special treatment for 'item' " ---------------------------- if g:tex_indent_items - " '\item' or '\bibitem' itself: if cline =~ g:tex_items let ind = ind - &sw + let stay = 0 endif - " lines following to '\item' are intented once again: if line =~ g:tex_items let ind = ind + &sw + let stay = 0 + endif + endif + + if stay + " If there is no obvious indentation hint, we trust our user. + if empty(cline) + return ind + else + return max([indent(v:lnum), s:GetLastBeginIndentation(v:lnum)]) + endif + else + return ind + endif +endfunction "}}} + +function! s:GetLastBeginIndentation(lnum) " {{{ + let matchend = 1 + for lnum in range(a:lnum-1, max([a:lnum - g:tex_max_scan_line, 1]), -1) + let line = getline(lnum) + if line =~ '\\end{.*}' + let matchend += 1 + endif + if line =~ '\\begin{.*}' + let matchend -= 1 endif + if matchend == 0 + if line =~ g:tex_itemize_env + return indent(lnum) + 2 * &sw + endif + if line =~ g:tex_noindent_env + return indent(lnum) + endif + return indent(lnum) + &sw + endif + endfor + return -1 +endfunction + +function! s:GetEndIndentation(lnum) " {{{ + if getline(a:lnum) =~ '\\begin{.*}.*\\end{.*}' + return -1 + endif + + let min_indent = 100 + let matchend = 1 + for lnum in range(a:lnum-1, max([a:lnum-g:tex_max_scan_line, 1]), -1) + let line = getline(lnum) + if line =~ '\\end{.*}' + let matchend += 1 + endif + if line =~ '\\begin{.*}' + let matchend -= 1 + endif + if matchend == 0 + return indent(lnum) + endif + if !empty(line) + let min_indent = min([min_indent, indent(lnum)]) + endif + endfor + return min_indent - &sw +endfunction + +" Most of the code is from matchparen.vim +function! s:CheckPairedIsLastCharacter(lnum, col) "{{{ + " Get the character under the cursor and check if it's in 'matchpairs'. + let c_lnum = a:lnum + let c_col = a:col+1 + + + let c = getline(c_lnum)[c_col-1] + let plist = split(&matchpairs, '.\zs[:,]') + let i = index(plist, c) + if i < 0 + return 0 + endif + + " Figure out the arguments for searchpairpos(). + if i % 2 == 0 + let s_flags = 'nW' + let c2 = plist[i + 1] + else + let s_flags = 'nbW' + let c2 = c + let c = plist[i - 1] + endif + if c == '[' + let c = '\[' + let c2 = '\]' + endif + + " Find the match. When it was just before the cursor move it there for a + " moment. + let save_cursor = winsaveview() + call cursor(c_lnum, c_col) + + " When not in a string or comment ignore matches inside them. + " We match "escape" for special items, such as lispEscapeSpecial. + let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . + \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"' + execute 'if' s_skip '| let s_skip = 0 | endif' + + let stopline = max([0, c_lnum - g:tex_max_scan_line]) + + " Limit the search time to 300 msec to avoid a hang on very long lines. + " This fails when a timeout is not supported. + try + let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 100) + catch /E118/ + endtry + + call winrestview(save_cursor) + if m_lnum > 0 + let line = getline(m_lnum) + return strlen(line) == m_col endif - return ind + return 0 endfunction "}}} let &cpo = s:cpo_save diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim index 3e847b9575..6982859670 100644 --- a/runtime/indent/vhdl.vim +++ b/runtime/indent/vhdl.vim @@ -1,8 +1,8 @@ " VHDL indent ('93 syntax) " Language: VHDL " Maintainer: Gerald Lai <laigera+vim?gmail.com> -" Version: 1.58 -" Last Change: 2011 Sep 27 +" Version: 1.60 +" Last Change: 2016 Feb 26 " URL: http://www.vim.org/scripts/script.php?script_id=1450 " only load this indent file when no other was loaded @@ -104,7 +104,7 @@ function GetVHDLindent() let pn = prevnonblank(pn - 1) let ps = getline(pn) endwhile - if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) + if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*\((.*)\)*\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\s\+\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) " align closing ")" with opening "(" if curs =~ '^\s*)' return ind2 + stridx(prevs_noi, '(') @@ -412,11 +412,22 @@ function GetVHDLindent() " **************************************************************************************** " indent: maintain indent of previous opening statement - " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + "in", "out", "inout", "buffer", "linkage", variable & ":=" + " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + eventually ;$ " where: start of current line - if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)' + if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*;.*$' return ind2 endif + " **************************************************************************************** + " indent: maintain indent of previous opening statement, corner case which + " does not end in ;, but is part of a mapping + " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=", never + ;$ and + " prevline without "procedure", "generic", "map", "port" + ":" but not ":=" + eventually ;$ + " where: start of current line + if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*[^;].*$' + if prevs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*;.*$' + return ind2 + endif + endif " return leftover filtered indent return ind diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 7511325af4..8ebfa12caf 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Dec 12 +" Last Change: 2016 Jun 27 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -58,19 +58,19 @@ function GetVimIndentIntern() if exists("g:vim_indent_cont") let ind = ind + g:vim_indent_cont else - let ind = ind + &sw * 3 + let ind = ind + shiftwidth() * 3 endif - elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END' - let ind = ind + &sw + elseif prev_text =~ '^\s*aug\%[roup]\s\+' && prev_text !~ '^\s*aug\%[roup]\s\+[eE][nN][dD]\>' + let ind = ind + shiftwidth() else " A line starting with :au does not increment/decrement indent. if prev_text !~ '^\s*au\%[tocmd]' let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') if i >= 0 - let ind += &sw + let ind += shiftwidth() if strpart(prev_text, i, 1) == '|' && has('syntax_items') \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' - let ind -= &sw + let ind -= shiftwidth() endif endif endif @@ -82,15 +82,15 @@ function GetVimIndentIntern() let i = match(prev_text, '[^\\]|\s*\(ene\@!\)') if i > 0 && prev_text !~ '^\s*au\%[tocmd]' if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " :endfun, :else and :augroup END. - if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)' - let ind = ind - &sw + if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s\+[eE][nN][dD]\)' + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/zimbu.vim b/runtime/indent/zimbu.vim index 9565b10843..5451877ea7 100644 --- a/runtime/indent/zimbu.vim +++ b/runtime/indent/zimbu.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Zimbu " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Sep 08 +" Last Change: 2016 Jan 25 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -74,9 +74,9 @@ func GetZimbuIndent(lnum) \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" \ . " =~ '\\(Comment\\|String\\|Char\\)$'") if pp > 0 - return indent(prevLnum) + &sw + return indent(prevLnum) + shiftwidth() endif - return indent(prevLnum) + &sw * 2 + return indent(prevLnum) + shiftwidth() * 2 endif if plnumstart == p return indent(prevLnum) @@ -102,13 +102,13 @@ func GetZimbuIndent(lnum) endif if prevline =~ '^\s*\(IF\|\|ELSEIF\|ELSE\|GENERATE_IF\|\|GENERATE_ELSEIF\|GENERATE_ELSE\|WHILE\|REPEAT\|TRY\|CATCH\|FINALLY\|FOR\|DO\|SWITCH\|CASE\|DEFAULT\|FUNC\|VIRTUAL\|ABSTRACT\|DEFINE\|REPLACE\|FINAL\|PROC\|MAIN\|NEW\|ENUM\|CLASS\|INTERFACE\|BITS\|MODULE\|SHARED\)\>' - let plindent += &sw + let plindent += shiftwidth() endif if thisline =~ '^\s*\(}\|ELSEIF\>\|ELSE\>\|CATCH\|FINALLY\|GENERATE_ELSEIF\>\|GENERATE_ELSE\>\|UNTIL\>\)' - let plindent -= &sw + let plindent -= shiftwidth() endif if thisline =~ '^\s*\(CASE\>\|DEFAULT\>\)' && prevline !~ '^\s*SWITCH\>' - let plindent -= &sw + let plindent -= shiftwidth() endif " line up continued comment that started after some code diff --git a/runtime/keymap/armenian-eastern_utf-8.vim b/runtime/keymap/armenian-eastern_utf-8.vim new file mode 100644 index 0000000000..7b03c5ac73 --- /dev/null +++ b/runtime/keymap/armenian-eastern_utf-8.vim @@ -0,0 +1,108 @@ +" Maintainer: Benjamin Linskey <vim@benlinskey.com> +" Last Changed: 2016 July 20 +" URL: https://github.com/blinskey/vim-armenian-keymaps + +let b:keymap_name = "hy" + +loadkeymap + +" Capital letters +A Ô± +B Ô² +C Ô³ +D Ô´ +Y Ôµ +Z Ô¶ +E Ô· +U Ô¸ +: Ô¹ ++ Ôº +I Ô» +L Ô¼ +Q Ô½ +? Ô¾ +K Ô¿ +H Õ€ +@ Õ +> Õ‚ +J Õƒ +M Õ„ +# Õ… +N Õ† +< Õ‡ +O Õˆ +{ Õ‰ +P ÕŠ +} Õ‹ +_ ÕŒ +S Õ +V ÕŽ +T Õ +R Õ +X Õ‘ +W Õ’ +\" Õ“ +G Õ” +) Õ• +F Õ– + +" Lowercase letters +a Õ¡ +b Õ¢ +c Õ£ +d Õ¤ +y Õ¥ +z Õ¦ +e Õ§ +u Õ¨ +; Õ© += Õª +i Õ« +l Õ¬ +q Õ +/ Õ® +k Õ¯ +h Õ° +2 Õ± +. Õ² +j Õ³ +m Õ´ +3 Õµ +n Õ¶ +, Õ· +o Õ¸ +[ Õ¹ +p Õº +] Õ» +- Õ¼ +s Õ½ +v Õ¾ +t Õ¿ +r Ö€ +x Ö +w Ö‚ +' Öƒ +g Ö„ +0 Ö… +f Ö† + +& Ö‡ + +" Punctuation +` Õ +~ Õœ +1 Ö‰ +4 Õ› +5 , +6 - +7 . +8 « +9 » +\\ ' +| Õž + +" Numbers +! 1 +$ 3 +% 4 +^ 9 diff --git a/runtime/keymap/armenian-western_utf-8.vim b/runtime/keymap/armenian-western_utf-8.vim new file mode 100644 index 0000000000..e02485ed8c --- /dev/null +++ b/runtime/keymap/armenian-western_utf-8.vim @@ -0,0 +1,108 @@ +" Maintainer: Benjamin Linskey <vim@benlinskey.com> +" Last Changed: 2016 July 20 +" URL: https://github.com/blinskey/vim-armenian-keymaps + +let b:keymap_name = "hy" + +loadkeymap + +" Capital letters +A Ô± +P Ô² +C Ô³ +T Ô´ +Y Ôµ +Z Ô¶ +E Ô· +U Ô¸ +: Ô¹ ++ Ôº +I Ô» +L Ô¼ +Q Ô½ +? Ô¾ +G Ô¿ +H Õ€ +@ Õ +> Õ‚ +J Õƒ +M Õ„ +# Õ… +N Õ† +< Õ‡ +O Õˆ +{ Õ‰ +B ÕŠ +} Õ‹ +_ ÕŒ +S Õ +W ÕŽ +D Õ +R Õ +X Õ‘ +V Õ’ +\" Õ“ +K Õ” +) Õ• +F Õ– + +" Lowercase letters +a Õ¡ +p Õ¢ +c Õ£ +t Õ¤ +y Õ¥ +z Õ¦ +e Õ§ +u Õ¨ +; Õ© += Õª +i Õ« +l Õ¬ +q Õ +/ Õ® +g Õ¯ +h Õ° +2 Õ± +. Õ² +j Õ³ +m Õ´ +3 Õµ +n Õ¶ +, Õ· +o Õ¸ +[ Õ¹ +b Õº +] Õ» +- Õ¼ +s Õ½ +w Õ¾ +d Õ¿ +r Ö€ +x Ö +v Ö‚ +' Öƒ +k Ö„ +0 Ö… +f Ö† + +& Ö‡ + +" Punctuation +` Õ +~ Õœ +1 Ö‰ +4 Õ› +5 , +6 - +7 . +8 « +9 » +\\ ' +| Õž + +" Numbers +! 1 +$ 3 +% 4 +^ 9 diff --git a/runtime/keymap/vietnamese-telex_utf-8.vim b/runtime/keymap/vietnamese-telex_utf-8.vim new file mode 100644 index 0000000000..f9fd055d14 --- /dev/null +++ b/runtime/keymap/vietnamese-telex_utf-8.vim @@ -0,0 +1,196 @@ +" Vim Keymap file for Vietnamese through Telex method +" Maintainer: Raphael McSinyx <vn.mcsinyx@gmail.com> +" Last Change: 2016-06-13 + +scriptencoding utf-8 + +let b:keymap_name = "vi" + +loadkeymap + +A\\ A +AF À +AS à +AR Ả +AX à +AJ Ạ+ +AW Ä‚ +AW\\ Ä‚ +AWF Ằ +AWS Ắ +AWR Ẳ +AWX Ẵ +AWJ Ặ + +AA  +AA\\  +AAF Ầ +AAS Ấ +AAR Ẩ +AAX Ẫ +AAJ Ậ + +D\\ D +DD Ä + +E E +E\\ E +EF È +ES É +ER Ẻ +EX Ẽ +EJ Ẹ + +EE Ê +EE\\ Ê +EEF Ề +EES Ế +EER Ể +EEX Ễ +EEJ Ệ + +I\\ I +IF ÃŒ +IS à +IR Ỉ +IX Ĩ +IJ Ị + +O\\ O +OF Ã’ +OS Ó +OR Ỏ +OX Õ +OJ Ọ + +OO Ô +OO\\ Ô +OOF á»’ +OOS á» +OOR á»” +OOX á»– +OOJ Ộ + +OW Æ +OW\\ Æ +OWF Ờ +OWS Ớ +OWR Ở +OWX á» +OWJ Ợ + +U\\ U +UF Ù +US Ú +UR Ủ +UX Ũ +UJ Ụ + +UW Ư +UW\\ Ư +UWF Ừ +UWS Ứ +UWR Ử +UWX á»® +UWJ á»° + +Y\\ Y +YF Ỳ +YS à +YR á»¶ +YX Ỹ +YJ á»´ + +a\\ a +af à +as á +ar ả +ax ã +aj ạ + +aw ă +aw\\ ă +awf ằ +aws ắ +awr ẳ +awx ẵ +awj ặ + +aa â +aa\\ â +aaf ầ +aas ấ +aar ẩ +aax ẫ +aaj Ạ+ +d\\ d +dd Ä‘ + +e\\ e +ef è +es é +er ẻ +ex ẽ +ej ẹ + +ee ê +ee\\ ê +eef á» +ees ế +eer ể +eex á»… +eej ệ + +i\\ i +if ì +is à +ir ỉ +ix Ä© +ij ị + +o\\ o +of ò +os ó +or á» +ox õ +oj á» + +oo ô +oo\\ ô +oof ồ +oos ố +oor ổ +oox á»— +ooj á»™ + +ow Æ¡ +ow\\ Æ¡ +owf á» +ows á»› +owr ở +owx ỡ +owj ợ + +u\\ u +uf ù +us ú +ur á»§ +ux Å© +uj ụ + +uw ư +uw\\ ư +uwf ừ +uws ứ +uwr á» +uwx ữ +uwj á»± + +y\\ y +yf ỳ +ys ý +yr á»· +yx ỹ +yj ỵ diff --git a/runtime/keymap/vietnamese-vni_utf-8.vim b/runtime/keymap/vietnamese-vni_utf-8.vim new file mode 100644 index 0000000000..c9312c6854 --- /dev/null +++ b/runtime/keymap/vietnamese-vni_utf-8.vim @@ -0,0 +1,196 @@ +" Vim Keymap file for Vietnamese through VNI method +" Maintainer: Raphael McSinyx <vn.mcsinyx@gmail.com> +" Last Change: 2016-06-13 + +scriptencoding utf-8 + +let b:keymap_name = "vi" + +loadkeymap + +A\\ A +A1 à +A2 À +A3 Ả +A4 à +A5 Ạ+ +A8 Ä‚ +A8\\ Ä‚ +A81 Ắ +A82 Ằ +A83 Ẳ +A84 Ẵ +A85 Ặ + +A6  +A6\\  +A61 Ấ +A62 Ầ +A63 Ẩ +A64 Ẫ +A65 Ậ + +D D +D\\ D +D9 Ä + +E\\ E +E1 É +E2 È +E3 Ẻ +E4 Ẽ +E5 Ẹ + +E6 Ê +E6\\ Ê +E61 Ế +E62 Ề +E63 Ể +E64 Ễ +E65 Ệ + +I\\ I +I1 à +I2 ÃŒ +I3 Ỉ +I4 Ĩ +I5 Ị + +O\\ O +O1 Ó +O2 Ã’ +O3 Ỏ +O4 Õ +O5 Ọ + +O6 Ô +O6\\ Ô +O61 á» +O62 á»’ +O63 á»” +O64 á»– +O65 Ộ + +O7 Æ +O7\\ Æ +O71 Ớ +O72 Ờ +O73 Ở +O74 á» +O75 Ợ + +U\\ U +U1 Ú +U2 Ù +U3 Ủ +U4 Ũ +U5 Ụ + +U7 Ư +U7\\ Ư +U71 Ứ +U72 Ừ +U73 Ử +U74 á»® +U75 á»° + +Y\\ Y +Y1 à +Y2 Ỳ +Y3 á»¶ +Y4 Ỹ +Y5 á»´ + +a\\ a +a1 á +a2 à +a3 ả +a4 ã +a5 ạ + +a8 ă +a8\\ ă +a81 ắ +a82 ằ +a83 ẳ +a84 ẵ +a85 ặ + +a6 â +a6\\ â +a61 ấ +a62 ầ +a63 ẩ +a64 ẫ +a65 Ạ+ +d\\ d +d9 Ä‘ + +e\\ e +e1 é +e2 è +e3 ẻ +e4 ẽ +e5 ẹ + +e6 ê +e6\\ ê +e61 ế +e62 á» +e63 ể +e64 á»… +e65 ệ + +i\\ i +i1 à +i2 ì +i3 ỉ +i4 Ä© +i5 ị + +o\\ o +o1 ó +o2 ò +o3 á» +o4 õ +o5 á» + +o6 ô +o6\\ ô +o61 ố +o62 ồ +o63 ổ +o64 á»— +o65 á»™ + +o7 Æ¡ +o7\\ Æ¡ +o71 á»› +o72 á» +o73 ở +o74 ỡ +o75 ợ + +u\\ u +u1 ú +u2 ù +u3 á»§ +u4 Å© +u5 ụ + +u7 ư +u7\\ ư +u71 ứ +u72 ừ +u73 á» +u74 ữ +u75 á»± + +y\\ y +y1 ý +y2 ỳ +y3 á»· +y4 ỹ +y5 ỵ diff --git a/runtime/macros/justify.vim b/runtime/macros/justify.vim index 4ef3bf95fa..011a911401 100644 --- a/runtime/macros/justify.vim +++ b/runtime/macros/justify.vim @@ -1,316 +1,3 @@ -" Function to left and right align text. -" -" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk> -" Created: 980806 14:13 (or around that time anyway) -" Revised: 001103 00:36 (See "Revisions" below) - - -" function Justify( [ textwidth [, maxspaces [, indent] ] ] ) -" -" Justify() will left and right align a line by filling in an -" appropriate amount of spaces. Extra spaces are added to existing -" spaces starting from the right side of the line. As an example, the -" following documentation has been justified. -" -" The function takes the following arguments: - -" textwidth argument -" ------------------ -" If not specified, the value of the 'textwidth' option is used. If -" 'textwidth' is zero a value of 80 is used. -" -" Additionally the arguments 'tw' and '' are accepted. The value of -" 'textwidth' will be used. These are handy, if you just want to specify -" the maxspaces argument. - -" maxspaces argument -" ------------------ -" If specified, alignment will only be done, if the longest space run -" after alignment is no longer than maxspaces. -" -" An argument of '' is accepted, should the user like to specify all -" arguments. -" -" To aid user defined commands, negative values are accepted aswell. -" Using a negative value specifies the default behaviour: any length of -" space runs will be used to justify the text. - -" indent argument -" --------------- -" This argument specifies how a line should be indented. The default is -" to keep the current indentation. -" -" Negative values: Keep current amount of leading whitespace. -" Positive values: Indent all lines with leading whitespace using this -" amount of whitespace. -" -" Note that the value 0, needs to be quoted as a string. This value -" leads to a left flushed text. -" -" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be -" added. In this case, if the value of indent is positive, the amount of -" whitespace to be added will be multiplied by the value of the -" 'shiftwidth' and 'tabstop' settings. If these units are used, the -" argument must be given as a string, eg. Justify('','','2sw'). -" -" If the values of 'sw' or 'tw' are negative, they are treated as if -" they were 0, which means that the text is flushed left. There is no -" check if a negative number prefix is used to change the sign of a -" negative 'sw' or 'ts' value. -" -" As with the other arguments, '' may be used to get the default -" behaviour. - - -" Notes: -" -" If the line, adjusted for space runs and leading/trailing whitespace, -" is wider than the used textwidth, the line will be left untouched (no -" whitespace removed). This should be equivalent to the behaviour of -" :left, :right and :center. -" -" If the resulting line is shorter than the used textwidth it is left -" untouched. -" -" All space runs in the line are truncated before the alignment is -" carried out. -" -" If you have set 'noexpandtab', :retab! is used to replace space runs -" with whitespace using the value of 'tabstop'. This should be -" conformant with :left, :right and :center. -" -" If joinspaces is set, an extra space is added after '.', '?' and '!'. -" If 'cpooptions' include 'j', extra space is only added after '.'. -" (This may on occasion conflict with maxspaces.) - - -" Related mappings: -" -" Mappings that will align text using the current text width, using at -" most four spaces in a space run and keeping current indentation. -nmap _j :%call Justify('tw',4)<CR> -vmap _j :call Justify('tw',4)<CR> -" -" Mappings that will remove space runs and format lines (might be useful -" prior to aligning the text). -nmap ,gq :%s/\s\+/ /g<CR>gq1G -vmap ,gq :s/\s\+/ /g<CR>gvgq - - -" User defined command: -" -" The following is an ex command that works as a shortcut to the Justify -" function. Arguments to Justify() can be added after the command. -com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>) -" -" The following commands are all equivalent: -" -" 1. Simplest use of Justify(): -" :call Justify() -" :Justify -" -" 2. The _j mapping above via the ex command: -" :%Justify tw 4 -" -" 3. Justify visualised text at 72nd column while indenting all -" previously indented text two shiftwidths -" :'<,'>call Justify(72,'','2sw') -" :'<,'>Justify 72 -1 2sw -" -" This documentation has been justified using the following command: -":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" / - -" Revisions: -" 001103: If 'joinspaces' was set, calculations could be wrong. -" Tabs at start of line could also lead to errors. -" Use setline() instead of "exec 's/foo/bar/' - safer. -" Cleaned up the code a bit. -" -" Todo: Convert maps to the new script specific form - -" Error function -function! Justify_error(message) - echohl Error - echo "Justify([tw, [maxspaces [, indent]]]): " . a:message - echohl None -endfunction - - -" Now for the real thing -function! Justify(...) range - - if a:0 > 3 - call Justify_error("Too many arguments (max 3)") - return 1 - endif - - " Set textwidth (accept 'tw' and '' as arguments) - if a:0 >= 1 - if a:1 =~ '^\(tw\)\=$' - let tw = &tw - elseif a:1 =~ '^\d\+$' - let tw = a:1 - else - call Justify_error("tw must be a number (>0), '' or 'tw'") - return 2 - endif - else - let tw = &tw - endif - if tw == 0 - let tw = 80 - endif - - " Set maximum number of spaces between WORDs - if a:0 >= 2 - if a:2 == '' - let maxspaces = tw - elseif a:2 =~ '^-\d\+$' - let maxspaces = tw - elseif a:2 =~ '^\d\+$' - let maxspaces = a:2 - else - call Justify_error("maxspaces must be a number or ''") - return 3 - endif - else - let maxspaces = tw - endif - if maxspaces <= 1 - call Justify_error("maxspaces should be larger than 1") - return 4 - endif - - " Set the indentation style (accept sw and ts units) - let indent_fix = '' - if a:0 >= 3 - if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$' - let indent = -1 - elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$' - let indent = 0 - elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$' - let indent = substitute(a:3, '\D', '', 'g') - elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$' - let indent = 1 - else - call Justify_error("indent: a number with 'sw'/'ts' unit") - return 5 - endif - if indent >= 0 - while indent > 0 - let indent_fix = indent_fix . ' ' - let indent = indent - 1 - endwhile - let indent_sw = 0 - if a:3 =~ '\(shiftwidth\|sw\)' - let indent_sw = &sw - elseif a:3 =~ '\(tabstop\|ts\)' - let indent_sw = &ts - endif - let indent_fix2 = '' - while indent_sw > 0 - let indent_fix2 = indent_fix2 . indent_fix - let indent_sw = indent_sw - 1 - endwhile - let indent_fix = indent_fix2 - endif - else - let indent = -1 - endif - - " Avoid substitution reports - let save_report = &report - set report=1000000 - - " Check 'joinspaces' and 'cpo' - if &js == 1 - if &cpo =~ 'j' - let join_str = '\(\. \)' - else - let join_str = '\([.!?!] \)' - endif - endif - - let cur = a:firstline - while cur <= a:lastline - - let str_orig = getline(cur) - let save_et = &et - set et - exec cur . "retab" - let &et = save_et - let str = getline(cur) - - let indent_str = indent_fix - let indent_n = strlen(indent_str) - " Shall we remember the current indentation - if indent < 0 - let indent_orig = matchstr(str_orig, '^\s*') - if strlen(indent_orig) > 0 - let indent_str = indent_orig - let indent_n = strlen(matchstr(str, '^\s*')) - endif - endif - - " Trim trailing, leading and running whitespace - let str = substitute(str, '\s\+$', '', '') - let str = substitute(str, '^\s\+', '', '') - let str = substitute(str, '\s\+', ' ', 'g') - let str_n = strdisplaywidth(str) - - " Possible addition of space after punctuation - if exists("join_str") - let str = substitute(str, join_str, '\1 ', 'g') - endif - let join_n = strdisplaywidth(str) - str_n - - " Can extraspaces be added? - " Note that str_n may be less than strlen(str) [joinspaces above] - if strdisplaywidth(str) <= tw - indent_n && str_n > 0 - " How many spaces should be added - let s_add = tw - str_n - indent_n - join_n - let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n - let s_dup = s_add / s_nr - let s_mod = s_add % s_nr - - " Test if the changed line fits with tw - if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw - - " Duplicate spaces - while s_dup > 0 - let str = substitute(str, '\( \+\)', ' \1', 'g') - let s_dup = s_dup - 1 - endwhile - - " Add extra spaces from the end - while s_mod > 0 - let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '') - let s_mod = s_mod - 1 - endwhile - - " Indent the line - if indent_n > 0 - let str = substitute(str, '^', indent_str, '' ) - endif - - " Replace the line - call setline(cur, str) - - " Convert to whitespace - if &et == 0 - exec cur . 'retab!' - endif - - endif " Change of line - endif " Possible change - - let cur = cur + 1 - endwhile - - norm ^ - - let &report = save_report - -endfunction - -" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai +" Load the justify package. +" For those users who were loading the justify plugin from here. +packadd justify diff --git a/runtime/macros/shellmenu.vim b/runtime/macros/shellmenu.vim index 6175d1d9a6..4eb72a556a 100644 --- a/runtime/macros/shellmenu.vim +++ b/runtime/macros/shellmenu.vim @@ -1,94 +1,3 @@ -" When you're writing shell scripts and you are in doubt which test to use, -" which shell environment variables are defined, what the syntax of the case -" statement is, and you need to invoke 'man sh'? -" -" Your problems are over now! -" -" Attached is a Vim script file for turning gvim into a shell script editor. -" It may also be used as an example how to use menus in Vim. -" -" Written by: Lennart Schultz <les@dmi.min.dk> - -imenu Stmts.for for in
do
doneki kk0elli -imenu Stmts.case case in
) ;;
esacbki k0elli -imenu Stmts.if if
then
fiki kk0elli -imenu Stmts.if-else if
then
else
fiki kki kk0elli -imenu Stmts.elif elif
then
ki kk0elli -imenu Stmts.while while
do
doneki kk0elli -imenu Stmts.break break -imenu Stmts.continue continue -imenu Stmts.function () {
}ki k0i -imenu Stmts.return return -imenu Stmts.return-true return 0 -imenu Stmts.return-false return 1 -imenu Stmts.exit exit -imenu Stmts.shift shift -imenu Stmts.trap trap -imenu Test.existence [ -e ]hi -imenu Test.existence - file [ -f ]hi -imenu Test.existence - file (not empty) [ -s ]hi -imenu Test.existence - directory [ -d ]hi -imenu Test.existence - executable [ -x ]hi -imenu Test.existence - readable [ -r ]hi -imenu Test.existence - writable [ -w ]hi -imenu Test.String is empty [ x = "x$" ]hhi -imenu Test.String is not empty [ x != "x$" ]hhi -imenu Test.Strings is equal [ "" = "" ]hhhhhhhi -imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi -imenu Test.Values is greater than [ -gt ]hhhhhhi -imenu Test.Values is greater equal [ -ge ]hhhhhhi -imenu Test.Values is equal [ -eq ]hhhhhhi -imenu Test.Values is not equal [ -ne ]hhhhhhi -imenu Test.Values is less than [ -lt ]hhhhhhi -imenu Test.Values is less equal [ -le ]hhhhhhi -imenu ParmSub.Substitute word if parm not set ${:-}hhi -imenu ParmSub.Set parm to word if not set ${:=}hhi -imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi -imenu ParmSub.If parm not set print word and exit ${:?}hhi -imenu SpShVars.Number of positional parameters ${#} -imenu SpShVars.All positional parameters (quoted spaces) ${*} -imenu SpShVars.All positional parameters (unquoted spaces) ${@} -imenu SpShVars.Flags set ${-} -imenu SpShVars.Return code of last command ${?} -imenu SpShVars.Process number of this shell ${$} -imenu SpShVars.Process number of last background command ${!} -imenu Environ.HOME ${HOME} -imenu Environ.PATH ${PATH} -imenu Environ.CDPATH ${CDPATH} -imenu Environ.MAIL ${MAIL} -imenu Environ.MAILCHECK ${MAILCHECK} -imenu Environ.PS1 ${PS1} -imenu Environ.PS2 ${PS2} -imenu Environ.IFS ${IFS} -imenu Environ.SHACCT ${SHACCT} -imenu Environ.SHELL ${SHELL} -imenu Environ.LC_CTYPE ${LC_CTYPE} -imenu Environ.LC_MESSAGES ${LC_MESSAGES} -imenu Builtins.cd cd -imenu Builtins.echo echo -imenu Builtins.eval eval -imenu Builtins.exec exec -imenu Builtins.export export -imenu Builtins.getopts getopts -imenu Builtins.hash hash -imenu Builtins.newgrp newgrp -imenu Builtins.pwd pwd -imenu Builtins.read read -imenu Builtins.readonly readonly -imenu Builtins.return return -imenu Builtins.times times -imenu Builtins.type type -imenu Builtins.umask umask -imenu Builtins.wait wait -imenu Set.set set -imenu Set.unset unset -imenu Set.mark modified or modified variables set -a -imenu Set.exit when command returns non-zero exit code set -e -imenu Set.Disable file name generation set -f -imenu Set.remember function commands set -h -imenu Set.All keyword arguments are placed in the environment set -k -imenu Set.Read commands but do not execute them set -n -imenu Set.Exit after reading and executing one command set -t -imenu Set.Treat unset variables as an error when substituting set -u -imenu Set.Print shell input lines as they are read set -v -imenu Set.Print commands and their arguments as they are executed set -x +" Load the shellmenu package. +" For those users who were loading the shellmenu plugin from here. +packadd shellmenu diff --git a/runtime/macros/swapmous.vim b/runtime/macros/swapmous.vim index 8b85be050b..5884d83473 100644 --- a/runtime/macros/swapmous.vim +++ b/runtime/macros/swapmous.vim @@ -1,22 +1,3 @@ -" These macros swap the left and right mouse buttons (for left handed) -" Don't forget to do ":set mouse=a" or the mouse won't work at all -noremap <LeftMouse> <RightMouse> -noremap <2-LeftMouse> <2-RightMouse> -noremap <3-LeftMouse> <3-RightMouse> -noremap <4-LeftMouse> <4-RightMouse> -noremap <LeftDrag> <RightDrag> -noremap <LeftRelease> <RightRelease> -noremap <RightMouse> <LeftMouse> -noremap <2-RightMouse> <2-LeftMouse> -noremap <3-RightMouse> <3-LeftMouse> -noremap <4-RightMouse> <4-LeftMouse> -noremap <RightDrag> <LeftDrag> -noremap <RightRelease> <LeftRelease> -noremap g<LeftMouse> <C-RightMouse> -noremap g<RightMouse> <C-LeftMouse> -noremap! <LeftMouse> <RightMouse> -noremap! <LeftDrag> <RightDrag> -noremap! <LeftRelease> <RightRelease> -noremap! <RightMouse> <LeftMouse> -noremap! <RightDrag> <LeftDrag> -noremap! <RightRelease> <LeftRelease> +" Load the swapmouse package. +" For those users who were loading the swapmous plugin from here. +packadd swapmouse diff --git a/runtime/nvim.desktop b/runtime/nvim.desktop new file mode 100644 index 0000000000..be6a2eda82 --- /dev/null +++ b/runtime/nvim.desktop @@ -0,0 +1,81 @@ +[Desktop Entry] +Name=Neovim +GenericName=Text Editor +GenericName[de]=Texteditor +Comment=Edit text files +Comment[af]=Redigeer tekslêers +Comment[am]=የጽሑá á‹á‹áˆŽá‰½ ያስተካáŠáˆ‰ +Comment[ar]=ØØ±Ù‘ر Ù…Ù„ÙØ§Øª نصية +Comment[az]=MÉ™tn fayllarını redaktÉ™ edin +Comment[be]=Ð Ñдагаваньне Ñ‚ÑкÑтавых файлаў +Comment[bg]=Редактиране на текÑтови файлове +Comment[bn]=টেকà§à¦¸à§à¦Ÿ ফাইল à¦à¦¡à¦¿à¦Ÿ করà§à¦¨ +Comment[bs]=Izmijeni tekstualne datoteke +Comment[ca]=Edita fitxers de text +Comment[cs]=Úprava textových souborů +Comment[cy]=Golygu ffeiliau testun +Comment[da]=Redigér tekstfiler +Comment[de]=Textdateien bearbeiten +Comment[el]=ΕπεξεÏγασία αÏχείων κειμÎνου +Comment[en_CA]=Edit text files +Comment[en_GB]=Edit text files +Comment[es]=Edita archivos de texto +Comment[et]=Redigeeri tekstifaile +Comment[eu]=Editatu testu-fitxategiak +Comment[fa]=ویرایش پرونده‌های متنی +Comment[fi]=Muokkaa tekstitiedostoja +Comment[fr]=Édite des fichiers texte +Comment[ga]=Eagar comhad Téacs +Comment[gu]=લખાણ ફાઇલોમાં ફેરફાર કરો +Comment[he]=ערוך קבצי טקסט +Comment[hi]=पाठफ़ाइलें संपादित करें +Comment[hr]=UreÄ‘ivanje tekstualne datoteke +Comment[hu]=Szövegfájlok szerkesztése +Comment[id]=Edit file teks +Comment[it]=Modifica file di testo +Comment[ja]=テã‚ストファイルを編集ã—ã¾ã™ +Comment[kn]=ಪಠà³à²¯ ಕಡತಗಳನà³à²¨à³ ಸಂಪಾದಿಸೠ+Comment[ko]=í…스트 파ì¼ì„ 편집합니다 +Comment[lt]=Redaguoti tekstines bylas +Comment[lv]=Rediģēt teksta failus +Comment[mk]=Уреди текÑтуални фајлови +Comment[ml]=വാചക രചനകളൠതിരàµà´¤àµà´¤àµà´• +Comment[mn]=ТекÑÑ‚ файл боловÑруулах +Comment[mr]=गदà¥à¤¯ फाइल संपादित करा +Comment[ms]=Edit fail teks +Comment[nb]=Rediger tekstfiler +Comment[ne]=पाठफाइललाई संशोधन गरà¥à¤¨à¥à¤¹à¥‹à¤¸à¥ +Comment[nl]=Tekstbestanden bewerken +Comment[nn]=Rediger tekstfiler +Comment[no]=Rediger tekstfiler +Comment[or]=ପାଠàଯ ଫାଇଲଗàଡ଼ିକà ସମàପାଦନ କରନàତà +Comment[pa]=ਪਾਠਫਾਇਲਾਂ ਸੰਪਾਦਨ +Comment[pl]=Edytor plików tekstowych +Comment[pt]=Editar ficheiros de texto +Comment[pt_BR]=Edite arquivos de texto +Comment[ro]=Editare fiÅŸiere text +Comment[ru]=Редактор текÑтовых файлов +Comment[sk]=Úprava textových súborov +Comment[sl]=Urejanje datotek z besedili +Comment[sq]=Përpuno files teksti +Comment[sr]=Измени текÑтуалне датотеке +Comment[sr@Latn]=Izmeni tekstualne datoteke +Comment[sv]=Redigera textfiler +Comment[ta]=உரை கோபà¯à®ªà¯à®•ளை தொகà¯à®•à¯à®•வà¯à®®à¯ +Comment[th]=à¹à¸à¹‰à¹„ขà¹à¸Ÿà¹‰à¸¡à¸‚้à¸à¸„วาม +Comment[tk]=Metin faýllary editle +Comment[tr]=Metin dosyalarını düzenle +Comment[uk]=Редактор текÑтових файлів +Comment[vi]=Soạn thảo táºp tin văn bản +Comment[wa]=Asspougnî des fitchîs tecses +Comment[zh_CN]=编辑文本文件 +Comment[zh_TW]=ç·¨è¼¯æ–‡å—æª” +TryExec=nvim +Exec=nvim %F +Terminal=true +Type=Application +Keywords=Text;editor; +Icon=nvim +Categories=Utility;TextEditor; +StartupNotify=false +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; diff --git a/runtime/nvim.png b/runtime/nvim.png Binary files differnew file mode 100644 index 0000000000..dbc65ef363 --- /dev/null +++ b/runtime/nvim.png diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 68444dde01..a7b94d73d4 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Jul 22 +" Last Change: 2016 Aug 12 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 @@ -228,6 +228,8 @@ else endif call append("$", "runtimepath\tlist of directories used for runtime files and plugins") call <SID>OptionG("rtp", &rtp) +call append("$", "packpath\tlist of directories used for plugin packages") +call <SID>OptionG("pp", &pp) call append("$", "helpfile\tname of the main help file") call <SID>OptionG("hf", &hf) @@ -708,6 +710,10 @@ call <SID>Header("editing text") call append("$", "undolevels\tmaximum number of changes that can be undone") call append("$", "\t(global or local to buffer)") call append("$", " \tset ul=" . &ul) +call append("$", "undofile\tautomatically save and restore undo history") +call <SID>BinOptionG("udf", &udf) +call append("$", "undodir\tlist of directories for undo files") +call <SID>OptionG("udir", &udir) call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload") call append("$", " \tset ur=" . &ur) call append("$", "modified\tchanges have been made and not written to a file") @@ -1030,10 +1036,6 @@ if has("vertsplit") call append("$", "cmdwinheight\theight of the command-line window") call <SID>OptionG("cwh", &cwh) endif -call append("$", "undofile\tautomatically save and restore undo history") -call <SID>BinOptionG("udf", &udf) -call append("$", "undodir\tlist of directories for undo files") -call <SID>OptionG("udir", &udir) call <SID>Header("executing external commands") @@ -1193,6 +1195,8 @@ if has("multi_byte") endif call append("$", "ambiwidth\twidth of ambiguous width characters") call <SID>OptionG("ambw", &ambw) + call append("$", "emoji\temoji characters are full width") + call <SID>BinOptionG("emo", &emo) endif @@ -1246,6 +1250,9 @@ call append("$", "\t(local to buffer)") call <SID>BinOptionL("bl") call append("$", "debug\tset to \"msg\" to see all error messages") call append("$", " \tset debug=" . &debug) +call append("$", "signcolumn\twhether to show the signcolumn") +call append("$", "\t(local to window)") +call <SID>OptionL("scl") set cpo&vim diff --git a/runtime/pack/dist/opt/justify/plugin/justify.vim b/runtime/pack/dist/opt/justify/plugin/justify.vim new file mode 100644 index 0000000000..4ef3bf95fa --- /dev/null +++ b/runtime/pack/dist/opt/justify/plugin/justify.vim @@ -0,0 +1,316 @@ +" Function to left and right align text. +" +" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk> +" Created: 980806 14:13 (or around that time anyway) +" Revised: 001103 00:36 (See "Revisions" below) + + +" function Justify( [ textwidth [, maxspaces [, indent] ] ] ) +" +" Justify() will left and right align a line by filling in an +" appropriate amount of spaces. Extra spaces are added to existing +" spaces starting from the right side of the line. As an example, the +" following documentation has been justified. +" +" The function takes the following arguments: + +" textwidth argument +" ------------------ +" If not specified, the value of the 'textwidth' option is used. If +" 'textwidth' is zero a value of 80 is used. +" +" Additionally the arguments 'tw' and '' are accepted. The value of +" 'textwidth' will be used. These are handy, if you just want to specify +" the maxspaces argument. + +" maxspaces argument +" ------------------ +" If specified, alignment will only be done, if the longest space run +" after alignment is no longer than maxspaces. +" +" An argument of '' is accepted, should the user like to specify all +" arguments. +" +" To aid user defined commands, negative values are accepted aswell. +" Using a negative value specifies the default behaviour: any length of +" space runs will be used to justify the text. + +" indent argument +" --------------- +" This argument specifies how a line should be indented. The default is +" to keep the current indentation. +" +" Negative values: Keep current amount of leading whitespace. +" Positive values: Indent all lines with leading whitespace using this +" amount of whitespace. +" +" Note that the value 0, needs to be quoted as a string. This value +" leads to a left flushed text. +" +" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be +" added. In this case, if the value of indent is positive, the amount of +" whitespace to be added will be multiplied by the value of the +" 'shiftwidth' and 'tabstop' settings. If these units are used, the +" argument must be given as a string, eg. Justify('','','2sw'). +" +" If the values of 'sw' or 'tw' are negative, they are treated as if +" they were 0, which means that the text is flushed left. There is no +" check if a negative number prefix is used to change the sign of a +" negative 'sw' or 'ts' value. +" +" As with the other arguments, '' may be used to get the default +" behaviour. + + +" Notes: +" +" If the line, adjusted for space runs and leading/trailing whitespace, +" is wider than the used textwidth, the line will be left untouched (no +" whitespace removed). This should be equivalent to the behaviour of +" :left, :right and :center. +" +" If the resulting line is shorter than the used textwidth it is left +" untouched. +" +" All space runs in the line are truncated before the alignment is +" carried out. +" +" If you have set 'noexpandtab', :retab! is used to replace space runs +" with whitespace using the value of 'tabstop'. This should be +" conformant with :left, :right and :center. +" +" If joinspaces is set, an extra space is added after '.', '?' and '!'. +" If 'cpooptions' include 'j', extra space is only added after '.'. +" (This may on occasion conflict with maxspaces.) + + +" Related mappings: +" +" Mappings that will align text using the current text width, using at +" most four spaces in a space run and keeping current indentation. +nmap _j :%call Justify('tw',4)<CR> +vmap _j :call Justify('tw',4)<CR> +" +" Mappings that will remove space runs and format lines (might be useful +" prior to aligning the text). +nmap ,gq :%s/\s\+/ /g<CR>gq1G +vmap ,gq :s/\s\+/ /g<CR>gvgq + + +" User defined command: +" +" The following is an ex command that works as a shortcut to the Justify +" function. Arguments to Justify() can be added after the command. +com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>) +" +" The following commands are all equivalent: +" +" 1. Simplest use of Justify(): +" :call Justify() +" :Justify +" +" 2. The _j mapping above via the ex command: +" :%Justify tw 4 +" +" 3. Justify visualised text at 72nd column while indenting all +" previously indented text two shiftwidths +" :'<,'>call Justify(72,'','2sw') +" :'<,'>Justify 72 -1 2sw +" +" This documentation has been justified using the following command: +":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" / + +" Revisions: +" 001103: If 'joinspaces' was set, calculations could be wrong. +" Tabs at start of line could also lead to errors. +" Use setline() instead of "exec 's/foo/bar/' - safer. +" Cleaned up the code a bit. +" +" Todo: Convert maps to the new script specific form + +" Error function +function! Justify_error(message) + echohl Error + echo "Justify([tw, [maxspaces [, indent]]]): " . a:message + echohl None +endfunction + + +" Now for the real thing +function! Justify(...) range + + if a:0 > 3 + call Justify_error("Too many arguments (max 3)") + return 1 + endif + + " Set textwidth (accept 'tw' and '' as arguments) + if a:0 >= 1 + if a:1 =~ '^\(tw\)\=$' + let tw = &tw + elseif a:1 =~ '^\d\+$' + let tw = a:1 + else + call Justify_error("tw must be a number (>0), '' or 'tw'") + return 2 + endif + else + let tw = &tw + endif + if tw == 0 + let tw = 80 + endif + + " Set maximum number of spaces between WORDs + if a:0 >= 2 + if a:2 == '' + let maxspaces = tw + elseif a:2 =~ '^-\d\+$' + let maxspaces = tw + elseif a:2 =~ '^\d\+$' + let maxspaces = a:2 + else + call Justify_error("maxspaces must be a number or ''") + return 3 + endif + else + let maxspaces = tw + endif + if maxspaces <= 1 + call Justify_error("maxspaces should be larger than 1") + return 4 + endif + + " Set the indentation style (accept sw and ts units) + let indent_fix = '' + if a:0 >= 3 + if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = -1 + elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = 0 + elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = substitute(a:3, '\D', '', 'g') + elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$' + let indent = 1 + else + call Justify_error("indent: a number with 'sw'/'ts' unit") + return 5 + endif + if indent >= 0 + while indent > 0 + let indent_fix = indent_fix . ' ' + let indent = indent - 1 + endwhile + let indent_sw = 0 + if a:3 =~ '\(shiftwidth\|sw\)' + let indent_sw = &sw + elseif a:3 =~ '\(tabstop\|ts\)' + let indent_sw = &ts + endif + let indent_fix2 = '' + while indent_sw > 0 + let indent_fix2 = indent_fix2 . indent_fix + let indent_sw = indent_sw - 1 + endwhile + let indent_fix = indent_fix2 + endif + else + let indent = -1 + endif + + " Avoid substitution reports + let save_report = &report + set report=1000000 + + " Check 'joinspaces' and 'cpo' + if &js == 1 + if &cpo =~ 'j' + let join_str = '\(\. \)' + else + let join_str = '\([.!?!] \)' + endif + endif + + let cur = a:firstline + while cur <= a:lastline + + let str_orig = getline(cur) + let save_et = &et + set et + exec cur . "retab" + let &et = save_et + let str = getline(cur) + + let indent_str = indent_fix + let indent_n = strlen(indent_str) + " Shall we remember the current indentation + if indent < 0 + let indent_orig = matchstr(str_orig, '^\s*') + if strlen(indent_orig) > 0 + let indent_str = indent_orig + let indent_n = strlen(matchstr(str, '^\s*')) + endif + endif + + " Trim trailing, leading and running whitespace + let str = substitute(str, '\s\+$', '', '') + let str = substitute(str, '^\s\+', '', '') + let str = substitute(str, '\s\+', ' ', 'g') + let str_n = strdisplaywidth(str) + + " Possible addition of space after punctuation + if exists("join_str") + let str = substitute(str, join_str, '\1 ', 'g') + endif + let join_n = strdisplaywidth(str) - str_n + + " Can extraspaces be added? + " Note that str_n may be less than strlen(str) [joinspaces above] + if strdisplaywidth(str) <= tw - indent_n && str_n > 0 + " How many spaces should be added + let s_add = tw - str_n - indent_n - join_n + let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n + let s_dup = s_add / s_nr + let s_mod = s_add % s_nr + + " Test if the changed line fits with tw + if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw + + " Duplicate spaces + while s_dup > 0 + let str = substitute(str, '\( \+\)', ' \1', 'g') + let s_dup = s_dup - 1 + endwhile + + " Add extra spaces from the end + while s_mod > 0 + let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '') + let s_mod = s_mod - 1 + endwhile + + " Indent the line + if indent_n > 0 + let str = substitute(str, '^', indent_str, '' ) + endif + + " Replace the line + call setline(cur, str) + + " Convert to whitespace + if &et == 0 + exec cur . 'retab!' + endif + + endif " Change of line + endif " Possible change + + let cur = cur + 1 + endwhile + + norm ^ + + let &report = save_report + +endfunction + +" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai diff --git a/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim new file mode 100644 index 0000000000..6175d1d9a6 --- /dev/null +++ b/runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim @@ -0,0 +1,94 @@ +" When you're writing shell scripts and you are in doubt which test to use, +" which shell environment variables are defined, what the syntax of the case +" statement is, and you need to invoke 'man sh'? +" +" Your problems are over now! +" +" Attached is a Vim script file for turning gvim into a shell script editor. +" It may also be used as an example how to use menus in Vim. +" +" Written by: Lennart Schultz <les@dmi.min.dk> + +imenu Stmts.for for in
do
doneki kk0elli +imenu Stmts.case case in
) ;;
esacbki k0elli +imenu Stmts.if if
then
fiki kk0elli +imenu Stmts.if-else if
then
else
fiki kki kk0elli +imenu Stmts.elif elif
then
ki kk0elli +imenu Stmts.while while
do
doneki kk0elli +imenu Stmts.break break +imenu Stmts.continue continue +imenu Stmts.function () {
}ki k0i +imenu Stmts.return return +imenu Stmts.return-true return 0 +imenu Stmts.return-false return 1 +imenu Stmts.exit exit +imenu Stmts.shift shift +imenu Stmts.trap trap +imenu Test.existence [ -e ]hi +imenu Test.existence - file [ -f ]hi +imenu Test.existence - file (not empty) [ -s ]hi +imenu Test.existence - directory [ -d ]hi +imenu Test.existence - executable [ -x ]hi +imenu Test.existence - readable [ -r ]hi +imenu Test.existence - writable [ -w ]hi +imenu Test.String is empty [ x = "x$" ]hhi +imenu Test.String is not empty [ x != "x$" ]hhi +imenu Test.Strings is equal [ "" = "" ]hhhhhhhi +imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi +imenu Test.Values is greater than [ -gt ]hhhhhhi +imenu Test.Values is greater equal [ -ge ]hhhhhhi +imenu Test.Values is equal [ -eq ]hhhhhhi +imenu Test.Values is not equal [ -ne ]hhhhhhi +imenu Test.Values is less than [ -lt ]hhhhhhi +imenu Test.Values is less equal [ -le ]hhhhhhi +imenu ParmSub.Substitute word if parm not set ${:-}hhi +imenu ParmSub.Set parm to word if not set ${:=}hhi +imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi +imenu ParmSub.If parm not set print word and exit ${:?}hhi +imenu SpShVars.Number of positional parameters ${#} +imenu SpShVars.All positional parameters (quoted spaces) ${*} +imenu SpShVars.All positional parameters (unquoted spaces) ${@} +imenu SpShVars.Flags set ${-} +imenu SpShVars.Return code of last command ${?} +imenu SpShVars.Process number of this shell ${$} +imenu SpShVars.Process number of last background command ${!} +imenu Environ.HOME ${HOME} +imenu Environ.PATH ${PATH} +imenu Environ.CDPATH ${CDPATH} +imenu Environ.MAIL ${MAIL} +imenu Environ.MAILCHECK ${MAILCHECK} +imenu Environ.PS1 ${PS1} +imenu Environ.PS2 ${PS2} +imenu Environ.IFS ${IFS} +imenu Environ.SHACCT ${SHACCT} +imenu Environ.SHELL ${SHELL} +imenu Environ.LC_CTYPE ${LC_CTYPE} +imenu Environ.LC_MESSAGES ${LC_MESSAGES} +imenu Builtins.cd cd +imenu Builtins.echo echo +imenu Builtins.eval eval +imenu Builtins.exec exec +imenu Builtins.export export +imenu Builtins.getopts getopts +imenu Builtins.hash hash +imenu Builtins.newgrp newgrp +imenu Builtins.pwd pwd +imenu Builtins.read read +imenu Builtins.readonly readonly +imenu Builtins.return return +imenu Builtins.times times +imenu Builtins.type type +imenu Builtins.umask umask +imenu Builtins.wait wait +imenu Set.set set +imenu Set.unset unset +imenu Set.mark modified or modified variables set -a +imenu Set.exit when command returns non-zero exit code set -e +imenu Set.Disable file name generation set -f +imenu Set.remember function commands set -h +imenu Set.All keyword arguments are placed in the environment set -k +imenu Set.Read commands but do not execute them set -n +imenu Set.Exit after reading and executing one command set -t +imenu Set.Treat unset variables as an error when substituting set -u +imenu Set.Print shell input lines as they are read set -v +imenu Set.Print commands and their arguments as they are executed set -x diff --git a/runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim b/runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim new file mode 100644 index 0000000000..8b85be050b --- /dev/null +++ b/runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim @@ -0,0 +1,22 @@ +" These macros swap the left and right mouse buttons (for left handed) +" Don't forget to do ":set mouse=a" or the mouse won't work at all +noremap <LeftMouse> <RightMouse> +noremap <2-LeftMouse> <2-RightMouse> +noremap <3-LeftMouse> <3-RightMouse> +noremap <4-LeftMouse> <4-RightMouse> +noremap <LeftDrag> <RightDrag> +noremap <LeftRelease> <RightRelease> +noremap <RightMouse> <LeftMouse> +noremap <2-RightMouse> <2-LeftMouse> +noremap <3-RightMouse> <3-LeftMouse> +noremap <4-RightMouse> <4-LeftMouse> +noremap <RightDrag> <LeftDrag> +noremap <RightRelease> <LeftRelease> +noremap g<LeftMouse> <C-RightMouse> +noremap g<RightMouse> <C-LeftMouse> +noremap! <LeftMouse> <RightMouse> +noremap! <LeftDrag> <RightDrag> +noremap! <LeftRelease> <RightRelease> +noremap! <RightMouse> <LeftMouse> +noremap! <RightDrag> <LeftDrag> +noremap! <RightRelease> <LeftRelease> diff --git a/runtime/autoload/vimball.vim b/runtime/pack/dist/opt/vimball/autoload/vimball.vim index 9a5a73c3c1..1af6b19c88 100644 --- a/runtime/autoload/vimball.vim +++ b/runtime/pack/dist/opt/vimball/autoload/vimball.vim @@ -1,9 +1,9 @@ " vimball.vim : construct a file containing both paths and files -" Author: Charles E. Campbell, Jr. -" Date: Jan 17, 2012 -" Version: 35 +" Author: Charles E. Campbell +" Date: Apr 11, 2016 +" Version: 37 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim -" Copyright: (c) 2004-2011 by Charles E. Campbell, Jr. +" Copyright: (c) 2004-2011 by Charles E. Campbell " The VIM LICENSE applies to Vimball.vim, and Vimball.txt " (see |copyright|) except use "Vimball" instead of "Vim". " No warranty, express or implied. @@ -14,7 +14,7 @@ if &cp || exists("g:loaded_vimball") finish endif -let g:loaded_vimball = "v35" +let g:loaded_vimball = "v37" if v:version < 702 echohl WarningMsg echo "***warning*** this version of vimball needs vim 7.2" @@ -142,7 +142,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range let lastline= line("$") + 1 if lastline == 2 && getline("$") == "" - call setline(1,'" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.') + call setline(1,'" Vimball Archiver by Charles E. Campbell') call setline(2,'UseVimball') call setline(3,'finish') let lastline= line("$") + 1 @@ -179,7 +179,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range " remove the evidence setlocal nomod bh=wipe exe "tabn ".curtabnr - exe "tabc ".vbtabnr + exe "tabc! ".vbtabnr " restore options call vimball#RestoreSettings() @@ -280,7 +280,7 @@ fun! vimball#Vimball(really,...) " when AsNeeded/filename is filereadable or was present in VimballRecord if fname =~ '\<plugin/' let anfname= substitute(fname,'\<plugin/','AsNeeded/','') - if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~ anfname) + if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~# anfname) " call Decho("using anfname<".anfname."> instead of <".fname.">") let fname= anfname endif @@ -379,10 +379,10 @@ fun! vimball#Vimball(really,...) call s:RecordInFile(home) " restore events, delete tab and buffer - exe "tabn ".vbtabnr + exe "sil! tabn ".vbtabnr setlocal nomod bh=wipe - exe "tabn ".curtabnr - exe "tabc ".vbtabnr + exe "sil! tabn ".curtabnr + exe "sil! tabc! ".vbtabnr call vimball#RestoreSettings() call s:ChgDir(curdir) @@ -555,7 +555,7 @@ fun! vimball#ShowMesg(level,msg) set noruler noshowcmd redraw! - if &fo =~ '[ta]' + if &fo =~# '[ta]' echomsg "***vimball*** ".a:msg else if a:level == s:WARNING || a:level == s:USAGE @@ -715,7 +715,7 @@ fun! vimball#SaveSettings() " call Dfunc("SaveSettings()") let s:makeep = getpos("'a") let s:regakeep= @a - if exists("&acd") + if exists("+acd") let s:acdkeep = &acd endif let s:eikeep = &ei @@ -728,7 +728,7 @@ fun! vimball#SaveSettings() let s:vekeep = &ve let s:ffkeep = &l:ff let s:swfkeep = &l:swf - if exists("&acd") + if exists("+acd") setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf else setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf @@ -743,7 +743,7 @@ endfun fun! vimball#RestoreSettings() " call Dfunc("RestoreSettings()") let @a = s:regakeep - if exists("&acd") + if exists("+acd") let &acd = s:acdkeep endif let &l:fen = s:fenkeep @@ -760,7 +760,7 @@ fun! vimball#RestoreSettings() " call Decho("restore mark-a: makeep=".string(makeep)) call setpos("'a",s:makeep) endif - if exists("&acd") + if exists("+acd") unlet s:acdkeep endif unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep s:ffkeep diff --git a/runtime/doc/pi_vimball.txt b/runtime/pack/dist/opt/vimball/doc/vimball.txt index bbc74988ca..9965a216e4 100644 --- a/runtime/doc/pi_vimball.txt +++ b/runtime/pack/dist/opt/vimball/doc/vimball.txt @@ -1,4 +1,4 @@ -*pi_vimball.txt* For Vim version 7.4. Last change: 2012 Jan 17 +*vimball.txt* For Vim version 7.4. Last change: 2012 Jan 17 ---------------- Vimball Archiver diff --git a/runtime/pack/dist/opt/vimball/plugin/vimballPlugin.vim b/runtime/pack/dist/opt/vimball/plugin/vimballPlugin.vim new file mode 100644 index 0000000000..d7473a0296 --- /dev/null +++ b/runtime/pack/dist/opt/vimball/plugin/vimballPlugin.vim @@ -0,0 +1,43 @@ +" vimballPlugin : construct a file containing both paths and files +" Author: Charles E. Campbell +" Copyright: (c) 2004-2014 by Charles E. Campbell +" The VIM LICENSE applies to Vimball.vim, and Vimball.txt +" (see |copyright|) except use "Vimball" instead of "Vim". +" No warranty, express or implied. +" *** *** Use At-Your-Own-Risk! *** *** +" +" (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who +" judge. For in that which you judge another, you condemn yourself. For +" you who judge practice the same things. +" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_vimballPlugin") + finish +endif +let g:loaded_vimballPlugin = "v37" +let s:keepcpo = &cpo +set cpo&vim + +" ------------------------------------------------------------------------------ +" Public Interface: {{{1 +com! -range -complete=file -nargs=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>) +com! -nargs=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) +com! -nargs=0 VimballList call vimball#Vimball(0) +com! -nargs=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings() +augroup Vimball + au! + au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif + au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif + au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif + au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif + au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif + au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif +augroup END + +" ===================================================================== +" Restoration And Modelines: {{{1 +" vim: fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo diff --git a/runtime/plugin/health.vim b/runtime/plugin/health.vim new file mode 100644 index 0000000000..e3482cb0fe --- /dev/null +++ b/runtime/plugin/health.vim @@ -0,0 +1,8 @@ +function! s:complete(lead, _line, _pos) abort + return sort(filter(map(globpath(&runtimepath, 'autoload/health/*', 1, 1), + \ 'fnamemodify(v:val, ":t:r")'), + \ 'empty(a:lead) || v:val[:strlen(a:lead)-1] ==# a:lead')) +endfunction + +command! -nargs=* -complete=customlist,s:complete CheckHealth + \ call health#check([<f-args>]) diff --git a/runtime/plugin/man.vim b/runtime/plugin/man.vim index 8e5062a209..63faa15213 100644 --- a/runtime/plugin/man.vim +++ b/runtime/plugin/man.vim @@ -1,6 +1,13 @@ -if get(g:, 'loaded_man', 0) +" Maintainer: Anmol Sethi <anmol@aubble.com> + +if exists('g:loaded_man') finish endif let g:loaded_man = 1 -command! -count=0 -nargs=+ Man call man#get_page(<count>, <f-args>) +command! -range=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>) + +augroup man + autocmd! + autocmd BufReadCmd man://* call man#read_page(matchstr(expand('<amatch>'), 'man://\zs.*')) +augroup END diff --git a/runtime/plugin/matchit.vim b/runtime/plugin/matchit.vim index 70867b1f93..c0f1f08027 100644 --- a/runtime/plugin/matchit.vim +++ b/runtime/plugin/matchit.vim @@ -1,7 +1,8 @@ " matchit.vim: (global plugin) Extended "%" matching -" Last Change: Fri Jan 25 10:00 AM 2008 EST +" Last Change: Fri Jul 29 01:20 AM 2016 EST " Maintainer: Benji Fisher PhD <benji@member.AMS.org> " Version: 1.13.2, for Vim 6.3+ +" Fix from Tommy Allen included. " URL: http://www.vim.org/script.php?script_id=39 " Documentation: @@ -122,7 +123,6 @@ function! s:Match_wrapper(word, forward, mode) range " Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! if (match_words != s:last_words) || (&mps != s:last_mps) || \ exists("b:match_debug") - let s:last_words = match_words let s:last_mps = &mps " The next several lines were here before " BF started messing with this script. @@ -134,6 +134,7 @@ function! s:Match_wrapper(word, forward, mode) range \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' " s:all = pattern with all the keywords let match_words = match_words . (strlen(match_words) ? "," : "") . default + let s:last_words = match_words if match_words !~ s:notslash . '\\\d' let s:do_BR = 0 let s:pat = match_words @@ -254,12 +255,7 @@ function! s:Match_wrapper(word, forward, mode) range " Fifth step: actually start moving the cursor and call searchpair(). " Later, :execute restore_cursor to get to the original screen. - let restore_cursor = virtcol(".") . "|" - normal! g0 - let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor - normal! H - let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor - execute restore_cursor + let view = winsaveview() call cursor(0, curcol + 1) " normal! 0 " if curcol @@ -273,7 +269,7 @@ function! s:Match_wrapper(word, forward, mode) range let sp_return = searchpair(ini, mid, fin, flag, skip) let final_position = "call cursor(" . line(".") . "," . col(".") . ")" " Restore cursor position and original screen. - execute restore_cursor + call winrestview(view) normal! m' if sp_return > 0 execute final_position @@ -634,7 +630,7 @@ endfun " idea to give it its own matching patterns. fun! s:MultiMatch(spflag, mode) if !exists("b:match_words") || b:match_words == "" - return "" + return {} end let restore_options = (&ic ? "" : "no") . "ignorecase" if exists("b:match_ignorecase") @@ -694,15 +690,7 @@ fun! s:MultiMatch(spflag, mode) let skip = 's:comment\|string' endif let skip = s:ParseSkip(skip) - " let restore_cursor = line(".") . "G" . virtcol(".") . "|" - " normal! H - " let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor - let restore_cursor = virtcol(".") . "|" - normal! g0 - let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor - normal! H - let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor - execute restore_cursor + let view = winsaveview() " Third step: call searchpair(). " Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. @@ -720,14 +708,14 @@ fun! s:MultiMatch(spflag, mode) while level if searchpair(openpat, '', closepat, a:spflag, skip) < 1 call s:CleanUp(restore_options, a:mode, startline, startcol) - return "" + return {} endif let level = level - 1 endwhile - " Restore options and return a string to restore the original position. + " Restore options and return view dict to restore the original position. call s:CleanUp(restore_options, a:mode, startline, startcol) - return restore_cursor + return view endfun " Search backwards for "if" or "while" or "<tag>" or ... diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 873302efee..5db1f64c78 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Dec 31 +" Last Change: 2016 Feb 16 " Exit quickly when: " - this plugin was already loaded (or disabled) diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index 3776ac30f8..28e1c3ecf8 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -1,6 +1,6 @@ " netrwPlugin.vim: Handles file transfer and remote directory listing across a network " PLUGIN SECTION -" Date: Nov 07, 2014 +" Date: Feb 08, 2016 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v154" +let g:loaded_netrwPlugin = "v156" let s:keepcpo = &cpo set cpo&vim "DechoRemOn @@ -55,10 +55,10 @@ augroup Network augroup END " Commands: :Nread, :Nwrite, :NetUserPass {{{2 -com! -count=1 -nargs=* Nread call netrw#SavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#RestorePosn() -com! -range=% -nargs=* Nwrite call netrw#SavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#RestorePosn() +com! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call winrestview(s:svpos) +com! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos) com! -nargs=* NetUserPass call NetUserPass(<f-args>) -com! -nargs=* Nsource call netrw#SavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#RestorePosn() +com! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos) com! -nargs=? Ntree call netrw#SetTreetop(<q-args>) " Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2 diff --git a/runtime/plugin/vimballPlugin.vim b/runtime/plugin/vimballPlugin.vim deleted file mode 100644 index 59279774ca..0000000000 --- a/runtime/plugin/vimballPlugin.vim +++ /dev/null @@ -1,40 +0,0 @@ -" vimballPlugin : construct a file containing both paths and files -" Author: Charles E. Campbell, Jr. -" Copyright: (c) 2004-2010 by Charles E. Campbell, Jr. -" The VIM LICENSE applies to Vimball.vim, and Vimball.txt -" (see |copyright|) except use "Vimball" instead of "Vim". -" No warranty, express or implied. -" *** *** Use At-Your-Own-Risk! *** *** -" -" (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who -" judge. For in that which you judge another, you condemn yourself. For -" you who judge practice the same things. -" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim - -" --------------------------------------------------------------------- -" Load Once: {{{1 -if &cp || exists("g:loaded_vimballPlugin") - finish -endif -let g:loaded_vimballPlugin = "v35" -let s:keepcpo = &cpo -set cpo&vim - -" ------------------------------------------------------------------------------ -" Public Interface: {{{1 -com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>) -com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) -com! -na=0 VimballList call vimball#Vimball(0) -com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings() -au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") -au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif -au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif -au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") -au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif -au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif - -" ===================================================================== -" Restoration And Modelines: {{{1 -" vim: fdm=marker -let &cpo= s:keepcpo -unlet s:keepcpo diff --git a/runtime/scripts.vim b/runtime/scripts.vim index b62b0a5db8..c2f6d5cff1 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2014 Aug 24 +" Last change: 2016 May 21 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by @@ -240,7 +240,8 @@ else set ft=xhtml " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN") - elseif s:line1 =~? '\<DOCTYPE\s\+html\>' + " Avoid "doctype html", used by slim. + elseif s:line1 =~? '<!DOCTYPE\s\+html\>' set ft=html " PDF diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 76f60131f2..01dad3c7f2 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -61,6 +61,7 @@ an 50.10.320 &Syntax.AB.Ascii\ Doc :cal SetSyn("asciidoc")<CR> an 50.10.330 &Syntax.AB.ASP\ with\ VBScript :cal SetSyn("aspvbs")<CR> an 50.10.340 &Syntax.AB.ASP\ with\ Perl :cal SetSyn("aspperl")<CR> an 50.10.350 &Syntax.AB.Assembly.680x0 :cal SetSyn("asm68k")<CR> +an 50.10.355 &Syntax.AB.Assembly.AVR :cal SetSyn("avra")<CR> an 50.10.360 &Syntax.AB.Assembly.Flat :cal SetSyn("fasm")<CR> an 50.10.370 &Syntax.AB.Assembly.GNU :cal SetSyn("asm")<CR> an 50.10.380 &Syntax.AB.Assembly.GNU\ H-8300 :cal SetSyn("asmh8300")<CR> diff --git a/runtime/syntax/aptconf.vim b/runtime/syntax/aptconf.vim index 0607ca10f5..7a31b2d15e 100644 --- a/runtime/syntax/aptconf.vim +++ b/runtime/syntax/aptconf.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: APT config file " Maintainer: Yann Amar <quidame@poivron.org> -" Last Change: 2013 Apr 12 +" Last Change: 2015 Dec 22 " For version 5.x: Clear all syntax items " For version 6.x and 7.x: Quit when a syntax file was already loaded @@ -38,22 +38,22 @@ setlocal iskeyword+=/,-,.,_,+ " Incomplete keywords will be treated differently than completely bad strings: syn keyword aptconfGroupIncomplete - \ a[cquire] a[ptitude] d[ebtags] d[ebug] d[ir] d[pkg] d[select] - \ o[rderlist] p[ackagemanager] p[kgcachegen] q[uiet] r[pm] - \ u[nattended-upgrade] + \ a[cquire] a[dequate] a[ptitude] a[ptlistbugs] d[ebtags] d[ebug] + \ d[ir] d[pkg] d[select] o[rderlist] p[ackagemanager] p[kgcachegen] + \ q[uiet] r[pm] s[ynaptic] u[nattended-upgrade] w[hatmaps] " Only the following keywords can be used at toplevel (to begin an option): syn keyword aptconfGroup - \ acquire apt aptitude debtags debug dir dpkg dselect - \ orderlist packagemanager pkgcachegen quiet rpm - \ unattended-upgrade + \ acquire adequate apt aptitude aptlistbugs debtags debug + \ dir dpkg dselect orderlist packagemanager pkgcachegen + \ quiet rpm synaptic unattended-upgrade whatmaps " Possible options for each group: " Acquire: {{{ syn keyword aptconfAcquire contained - \ cdrom Check-Valid-Until CompressionTypes ForceHash ftp gpgv - \ GzipIndexes http https Languages Max-ValidTime Min-ValidTime PDiffs - \ Queue-Mode Retries Source-Symlinks + \ cdrom Check-Valid-Until CompressionTypes ForceHash ForceIPv4 + \ ForceIPv6 ftp gpgv GzipIndexes http https Languages Max-ValidTime + \ Min-ValidTime PDiffs Queue-Mode Retries Source-Symlinks syn keyword aptconfAcquireCDROM contained \ AutoDetect CdromOnly Mount UMount @@ -62,14 +62,15 @@ syn keyword aptconfAcquireCompressionTypes contained \ bz2 lzma gz Order syn keyword aptconfAcquireFTP contained - \ Passive Proxy ProxyLogin Timeout + \ ForceExtended Passive Proxy ProxyLogin Timeout syn keyword aptconfAcquireHTTP contained \ AllowRedirect Dl-Limit Max-Age No-Cache No-Store Pipeline-Depth - \ Proxy Timeout User-Agent + \ Proxy ProxyAutoDetect Proxy-Auto-Detect Timeout User-Agent syn keyword aptconfAcquireHTTPS contained - \ CaInfo CaPath CrlFile IssuerCert SslCert SslForceVersion SslKey + \ AllowRedirect CaInfo CaPath CrlFile Dl-Limit IssuerCert Max-Age + \ No-Cache No-Store Proxy SslCert SslForceVersion SslKey Timeout \ Verify-Host Verify-Peer syn keyword aptconfAcquireMaxValidTime contained @@ -83,14 +84,21 @@ syn cluster aptconfAcquire_ contains=aptconfAcquire, \ aptconfAcquireHTTP,aptconfAcquireHTTPS,aptconfAcquireMaxValidTime, \ aptconfAcquirePDiffs " }}} +" Adequate: {{{ +syn keyword aptconfAdequate contained + \ Enabled + +syn cluster aptconfAdequate_ contains=aptconfAdequate +" }}} " Apt: {{{ syn keyword aptconfApt contained \ Architecture Architectures Archive Authentication AutoRemove - \ Build-Essential Cache Cache-Grow Cache-Limit Cache-Start CDROM - \ Changelogs Clean-Installed Compressor Default-Release - \ Force-LoopBreak Get Ignore-Hold Immediate-Configure + \ Build-Essential Build-Profiles Cache Cache-Grow Cache-Limit + \ Cache-Start CDROM Changelogs Clean-Installed Compressor + \ Default-Release Force-LoopBreak Get Ignore-Hold Immediate-Configure \ Install-Recommends Install-Suggests Keep-Fds List-Cleanup - \ NeverAutoRemove Never-MarkAuto-Sections Periodic Status-Fd Update + \ Move-Autobit-Sections NeverAutoRemove Never-MarkAuto-Sections + \ Periodic Status-Fd Update VersionedKernelPackages syn keyword aptconfAptAuthentication contained \ TrustCDROM @@ -124,11 +132,12 @@ syn keyword aptconfAptGet contained syn keyword aptconfAptPeriodic contained \ AutocleanInterval BackupArchiveInterval BackupLevel - \ Download-Upgradeable-Packages MaxAge MaxSize MinAge - \ Unattended-Upgrade Update-Package-Lists Verbose + \ Download-Upgradeable-Packages Download-Upgradeable-Packages-Debdelta + \ Enable MaxAge MaxSize MinAge Unattended-Upgrade Update-Package-Lists + \ Verbose syn keyword aptconfAptUpdate contained - \ Pre-Invoke Post-Invoke Post-Invoke-Success + \ List-Refresh Pre-Invoke Post-Invoke Post-Invoke-Success syn cluster aptconfApt_ contains=aptconfApt, \ aptconfAptAuthentication,aptconfAptAutoRemove,aptconfAptCache, @@ -240,6 +249,12 @@ syn cluster aptconfAptitude_ contains=aptconfAptitude, \ aptconfAptitudeUIKeyBindings,aptconfAptitudeUIStyles, \ aptconfAptitudeUIStylesElements " }}} +" AptListbugs: {{{ +syn keyword aptconfAptListbugs contained + \ IgnoreRegexp Severities + +syn cluster aptconfAptListbugs_ contains=aptconfAptListbugs +" }}} " DebTags: {{{ syn keyword aptconfDebTags contained \ Vocabulary @@ -251,7 +266,8 @@ syn keyword aptconfDebug contained \ Acquire aptcdrom BuildDeps Hashes IdentCdrom Nolocking \ pkgAcquire pkgAutoRemove pkgCacheGen pkgDepCache pkgDPkgPM \ pkgDPkgProgressReporting pkgInitialize pkgOrderList - \ pkgPackageManager pkgPolicy pkgProblemResolver sourceList + \ pkgPackageManager pkgPolicy pkgProblemResolver RunScripts + \ sourceList syn keyword aptconfDebugAcquire contained \ cdrom Ftp gpgv Http Https netrc @@ -295,7 +311,7 @@ syn keyword aptconfDirMedia contained \ MountPath syn keyword aptconfDirState contained - \ cdroms extended_states Lists mirrors status + \ cdroms extended_states Lists mirrors preferences status syn cluster aptconfDir_ contains=aptconfDir, \ aptconfDirAptitude,aptconfDirBin,aptconfDirCache,aptconfDirEtc, @@ -303,15 +319,16 @@ syn cluster aptconfDir_ contains=aptconfDir, " }}} " DPkg: {{{ syn keyword aptconfDPkg contained - \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN MaxArgs - \ MaxBytes NoTriggers options Pre-Install-Pkgs Pre-Invoke Post-Invoke + \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN + \ MaxArgBytes MaxArgs MaxBytes NoTriggers options + \ Pre-Install-Pkgs Pre-Invoke Post-Invoke \ Run-Directory StopOnError Tools TriggersPending syn keyword aptconfDPkgTools contained - \ Options Version + \ adequate InfoFD Options Version syn cluster aptconfDPkg_ contains=aptconfDPkg, - \ aptconfDPkgOrderList,aptconfDPkgOrderListScore,aptconfDPkgTools + \ aptconfDPkgTools " }}} " DSelect: {{{ syn keyword aptconfDSelect contained @@ -353,23 +370,59 @@ syn keyword aptconfRpm contained syn cluster aptconfRpm_ contains=aptconfRpm " }}} -" Unattened Upgrade: {{{ +" Synaptic: {{{ +syn keyword aptconfSynaptic contained + \ AskQuitOnProceed AskRelated AutoCleanCache CleanCache DefaultDistro + \ delAction delHistory Download-Only ftpProxy ftpProxyPort httpProxy + \ httpProxyPort Install-Recommends LastSearchType Maximized noProxy + \ OneClickOnStatusActions ShowAllPkgInfoInMain showWelcomeDialog + \ ToolbarState undoStackSize update upgradeType useProxy UseStatusColors + \ UseTerminal useUserFont useUserTerminalFont ViewMode + \ availVerColumnPos availVerColumnVisible componentColumnPos + \ componentColumnVisible descrColumnPos descrColumnVisible + \ downloadSizeColumnPos downloadSizeColumnVisible hpanedPos + \ instVerColumnPos instVerColumnVisible instSizeColumnPos + \ instSizeColumnVisible nameColumnPos nameColumnVisible + \ sectionColumnPos sectionColumnVisible statusColumnPos + \ statusColumnVisible supportedColumnPos supportedColumnVisible + \ vpanedPos windowWidth windowHeight windowX windowY closeZvt + \ color-available color-available-locked color-broken color-downgrade + \ color-install color-installed-locked color-installed-outdated + \ color-installed-updated color-new color-purge color-reinstall + \ color-remove color-upgrade + +syn keyword aptconfSynapticUpdate contained + \ last type + +syn cluster aptconfSynaptic_ contains=aptconfSynaptic, + \ aptconfSynapticUpdate +" }}} +" Unattended Upgrade: {{{ syn keyword aptconfUnattendedUpgrade contained - \ AutoFixInterruptedDpkg Automatic-Reboot InstallOnShutdown Mail - \ MailOnlyOnError MinimalSteps Origins-Pattern Package-Blacklist + \ AutoFixInterruptedDpkg Automatic-Reboot Automatic-Reboot-Time + \ Automatic-Reboot-WithUsers InstallOnShutdown Mail MailOnlyOnError + \ MinimalSteps Origins-Pattern Package-Blacklist \ Remove-Unused-Dependencies syn cluster aptconfUnattendedUpgrade_ contains=aptconfUnattendedUpgrade " }}} +" Whatmaps: {{{ +syn keyword aptconfWhatmaps contained + \ Enable-Restart Security-Update-Origins + +syn cluster aptconfWhatmaps_ contains=aptconfWhatmaps +" }}} syn case match " Now put all the keywords (and 'valid' options) in a single cluster: syn cluster aptconfOptions contains=aptconfRegexpOpt, - \ @aptconfAcquire_,@aptconfApt_,@aptconfAptitude_,@aptconfDebTags_, - \ @aptconfDebug_,@aptconfDir_,@aptconfDPkg_,@aptconfDSelect_, - \ @aptconfOrderList_,@aptconfPackageManager_,@aptconfPkgCacheGen_, - \ @aptconfQuiet_,@aptconfRpm_,@aptconfUnattendedUpgrade_ + \ @aptconfAcquire_,@aptconfAdequate_,@aptconfApt_,@aptconfAptitude_, + \ @aptconfAptListbugs_,@aptconfDebTags_,@aptconfDebug_,@aptconfDir_, + \ @aptconfDPkg_,@aptconfDSelect_,@aptconfOrderList_, + \ @aptconfPackageManager_,@aptconfPkgCacheGen_,@aptconfQuiet_, + \ @aptconfRpm_,@aptconfSynaptic_,@aptconfUnattendedUpgrade_, + \ @aptconfWhatmaps_ " Syntax: syn match aptconfSemiColon ';' @@ -382,8 +435,11 @@ syn region aptconfInclude matchgroup=aptconfOperator start='::' end='::\|\s'me= " Basic Syntax Errors: XXX avoid to generate false positives !!! " -" * Invalid comment format (seems to not cause errors, but...): -syn match aptconfAsError display '^#.*' +" * Undocumented inline comment. Since it is currently largely used, and does +" not seem to cause trouble ('apt-config dump' never complains when # is used +" the same way than //) it has been moved to aptconfComment group. But it +" still needs to be defined here (i.e. before #clear and #include directives) +syn match aptconfComment '#.*' contains=@aptconfCommentSpecial " " * When a semicolon is missing after a double-quoted string: " There are some cases (for example in the Dir group of options, but not only) @@ -445,6 +501,8 @@ hi def link aptconfAcquireHTTPS aptconfOption hi def link aptconfAcquireMaxValidTime aptconfOption hi def link aptconfAcquirePDiffs aptconfOption +hi def link aptconfAdequate aptconfOption + hi def link aptconfApt aptconfOption hi def link aptconfAptAuthentication aptconfOption hi def link aptconfAptAutoRemove aptconfOption @@ -471,6 +529,8 @@ hi def link aptconfAptitudeUIKeyBindings aptconfOption hi def link aptconfAptitudeUIStyles aptconfOption hi def link aptconfAptitudeUIStylesElements aptconfOption +hi def link aptconfAptListbugs aptconfOption + hi def link aptconfDebTags aptconfOption hi def link aptconfDebug aptconfOption @@ -504,8 +564,13 @@ hi def link aptconfQuiet aptconfOption hi def link aptconfRpm aptconfOption +hi def link aptconfSynaptic aptconfOption +hi def link aptconfSynapticUpdate aptconfOption + hi def link aptconfUnattendedUpgrade aptconfOption +hi def link aptconfWhatmaps aptconfOption + let b:current_syntax = "aptconf" let &cpo = s:cpo_save diff --git a/runtime/syntax/avra.vim b/runtime/syntax/avra.vim new file mode 100644 index 0000000000..ebf0aaff11 --- /dev/null +++ b/runtime/syntax/avra.vim @@ -0,0 +1,73 @@ +" Vim syntax file +" Language: AVR Assembler (AVRA) +" AVRA Home: http://avra.sourceforge.net/index.html +" AVRA Version: 1.3.0 +" Maintainer: Marius Ghita <mhitza@gmail.com> + +let s:cpo_save = &cpo +set cpo&vim + +setlocal iskeyword=a-z,A-Z,48-57,.,_ +" 'isident' is a global option, better not set it +" setlocal isident=a-z,A-Z,48-57,.,_ +syn case ignore + +syn keyword avraRegister r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 +syn keyword avraRegister r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 +syn keyword avraRegister r28 r29 r30 r31 + +syn keyword avraInstr add adc adiw sub subi sbc sbci sbiw and andi or ori eor +syn keyword avraInstr com neg sbr cbr inc dec tst clr ser mul muls mulsu fmul +syn keyword avraInstr fmuls fmulsu des rjmp ijmp eijmp jmp rcall icall eicall +syn keyword avraInstr call ret reti cpse cp cpc cpi sbrc sbrs sbic sbis brbs +syn keyword avraInstr brbc breq brne brcs brcc brsh brlo brmi brpl brge brlt +syn keyword avraInstr brhs brhc brts brtc brvs brvc brie brid mov movw ldi lds +syn keyword avraInstr ld ldd sts st std lpm elpm spm in out push pop xch las +syn keyword avraInstr lac lat lsl lsr rol ror asr swap bset bclr sbi cbi bst bld +syn keyword avraInstr sec clc sen cln sez clz sei cli ses cls sev clv set clt +syn keyword avraInstr seh clh break nop sleep wdr + +syn keyword avraDirective .byte .cseg .db .def .device .dseg .dw .endmacro .equ +syn keyword avraDirective .eseg .exit .include .list .listmac .macro .nolist +syn keyword avraDirective .org .set .define .undef .ifdef .ifndef .if .else +syn keyword avraDirective .elif .elseif .warning + +syn keyword avraOperator low high byte2 byte3 byte4 lwrd hwrd page exp2 log2 + +syn match avraNumericOperator "[-*/+]" +syn match avraUnaryOperator "!" +syn match avraBinaryOperator "<<\|>>\|<\|<=\|>\|>=\|==\|!=" +syn match avraBitwiseOperator "[~&^|]\|&&\|||" + +syn match avraBinaryNumber "\<0[bB][0-1]*\>" +syn match avraHexNumber "\<0[xX][0-9a-fA-F]\+\>" +syn match avraDecNumber "\<\(0\|[1-9]\d*\)\>" + +syn region avraComment start=";" end="$" +syn region avraString start="\"" end="\"\|$" + +syn match avraLabel "^\s*[^; \t]\+:" + +hi def link avraBinaryNumber avraNumber +hi def link avraHexNumber avraNumber +hi def link avraDecNumber avraNumber + +hi def link avraNumericOperator avraOperator +hi def link avraUnaryOperator avraOperator +hi def link avraBinaryOperator avraOperator +hi def link avraBitwiseOperator avraOperator + + +hi def link avraOperator operator +hi def link avraComment comment +hi def link avraDirective preproc +hi def link avraRegister type +hi def link avraNumber constant +hi def link avraString String +hi def link avraInstr keyword +hi def link avraLabel label + +let b:current_syntax = "avra" + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/awk.vim b/runtime/syntax/awk.vim index 40491eea1a..ae0f217580 100644 --- a/runtime/syntax/awk.vim +++ b/runtime/syntax/awk.vim @@ -1,15 +1,15 @@ " Vim syntax file " Language: awk, nawk, gawk, mawk " Maintainer: Antonio Colombo <azc100@gmail.com> -" Last Change: 2014 Oct 21 +" Last Change: 2016 Jul 15 -" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger +" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger " The AWK Programming Language, Addison-Wesley, 1988 " GAWK ref. is: Arnold D. Robbins " Effective AWK Programming, Third Edition, O'Reilly, 2001 " Effective AWK Programming, Fourth Edition, O'Reilly, 2015 -" (also available with the gawk source distribution) +" (also available and updated with the gawk source distribution) " MAWK is a "new awk" meaning it implements AWK ref. " mawk conforms to the Posix 1003.2 (draft 11.3) @@ -19,11 +19,8 @@ " TODO: " Dig into the commented out syntax expressions below. -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syn clear -elseif exists("b:current_syntax") +" Quit when a syntax file was already loaded +if exists("b:current_syntax") finish endif @@ -35,13 +32,13 @@ set cpo&vim syn keyword awkStatement break continue delete exit syn keyword awkStatement function getline next syn keyword awkStatement print printf return -" GAWK ref. Chapter 7 -syn keyword awkStatement nextfile +" GAWK ref. Chapter 7-9 +syn keyword awkStatement switch nextfile +syn keyword awkStatement func " " GAWK ref. Chapter 9, Functions -" " Numeric Functions -syn keyword awkFunction atan2 cos div exp int log rand sin sqrt srand +syn keyword awkFunction atan2 cos exp int intdiv log rand sin sqrt srand " String Manipulation Functions syn keyword awkFunction asort asort1 gensub gsub index length match syn keyword awkFunction patsplit split sprintf strtonum sub substr @@ -52,17 +49,17 @@ syn keyword awkFunction close fflush system syn keyword awkFunction mktime strftime systime " Bit Manipulation Functions syn keyword awkFunction and compl lshift or rshift xor -" Getting Type Function -syn keyword awkFunction isarray +" Getting Type Functions +syn keyword awkFunction isarray typeof " String-Translation Functions syn keyword awkFunction bindtextdomain dcgettext dcngetext syn keyword awkConditional if else -syn keyword awkRepeat while for +syn keyword awkRepeat while for do -syn keyword awkTodo contained TODO +syn keyword awkTodo contained TODO -syn keyword awkPatterns BEGIN END +syn keyword awkPatterns BEGIN END BEGINFILE ENDFILE " GAWK ref. Chapter 7 " Built-in Variables That Control awk @@ -74,20 +71,18 @@ syn keyword awkVariables ARGC ARGV ARGIND ENVIRON ERRNO FILENAME syn keyword awkVariables FNR NF FUNCTAB NR PROCINFO RLENGTH RSTART syn keyword awkVariables RT SYMTAB -syn keyword awkRepeat do " Octal format character. syn match awkSpecialCharacter display contained "\\[0-7]\{1,3\}" -syn keyword awkStatement func nextfile " Hex format character. syn match awkSpecialCharacter display contained "\\x[0-9A-Fa-f]\+" syn match awkFieldVars "\$\d\+" -"catch errors caused by wrong parenthesis -syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass +" catch errors caused by wrong parenthesis +syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass,awkComment syn match awkParenError display ")" -syn match awkInParen display contained "[{}]" +"syn match awkInParen display contained "[{}]" " 64 lines for complex &&'s, and ||'s in a big "if" syn sync ccomment awkParen maxlines=64 @@ -141,7 +136,7 @@ syn match awkExpression "?\|:" syn keyword awkExpression in " Boolean Logic (OR, AND, NOT) -"syn match awkBoolLogic "||\|&&\|\!" +syn match awkBoolLogic "||\|&&\|\!" " This is overridden by less-than & greater-than. " Put this above those to override them. @@ -171,63 +166,42 @@ syn region awkArray transparent start="\[" end="\]" contains=awkArray,awkArrayE " (for the few instances where it would be more than "oneline") syn sync ccomment awkArray maxlines=10 -" define the default highlighting -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_awk_syn_inits") - if version < 508 - let did_awk_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink awkConditional Conditional - HiLink awkFunction Function - HiLink awkRepeat Repeat - HiLink awkStatement Statement - - HiLink awkString String - HiLink awkSpecialPrintf Special - HiLink awkSpecialCharacter Special - - HiLink awkSearch String - HiLink awkBrackets awkRegExp - HiLink awkBrktRegExp awkNestRegExp - HiLink awkCharClass awkNestRegExp - HiLink awkNestRegExp Keyword - HiLink awkRegExp Special - - HiLink awkNumber Number - HiLink awkFloat Float - - HiLink awkFileIO Special - HiLink awkOperator Special - HiLink awkExpression Special - HiLink awkBoolLogic Special - - HiLink awkPatterns Special - HiLink awkVariables Special - HiLink awkFieldVars Special - - HiLink awkLineSkip Special - HiLink awkSemicolon Special - HiLink awkComma Special - "HiLink awkIdentifier Identifier - - HiLink awkComment Comment - HiLink awkTodo Todo - - " Change this if you want nested array names to be highlighted. - HiLink awkArrayArray awkArray - HiLink awkArrayElement Special - - HiLink awkParenError awkError - HiLink awkInParen awkError - HiLink awkError Error - - delcommand HiLink -endif +" Define the default highlighting. +" Only used when an item doesn't have highlighting yet +hi def link awkConditional Conditional +hi def link awkFunction Function +hi def link awkRepeat Repeat +hi def link awkStatement Statement +hi def link awkString String +hi def link awkSpecialPrintf Special +hi def link awkSpecialCharacter Special +hi def link awkSearch String +hi def link awkBrackets awkRegExp +hi def link awkBrktRegExp awkNestRegExp +hi def link awkCharClass awkNestRegExp +hi def link awkNestRegExp Keyword +hi def link awkRegExp Special +hi def link awkNumber Number +hi def link awkFloat Float +hi def link awkFileIO Special +hi def link awkOperator Special +hi def link awkExpression Special +hi def link awkBoolLogic Special +hi def link awkPatterns Special +hi def link awkVariables Special +hi def link awkFieldVars Special +hi def link awkLineSkip Special +hi def link awkSemicolon Special +hi def link awkComma Special +hi def link awkIdentifier Identifier +hi def link awkComment Comment +hi def link awkTodo Todo +" Change this if you want nested array names to be highlighted. +hi def link awkArrayArray awkArray +hi def link awkArrayElement Special +hi def link awkParenError awkError +hi def link awkInParen awkError +hi def link awkError Error let b:current_syntax = "awk" diff --git a/runtime/syntax/bib.vim b/runtime/syntax/bib.vim index f84d5ca95a..8bd0528e1e 100644 --- a/runtime/syntax/bib.vim +++ b/runtime/syntax/bib.vim @@ -2,7 +2,7 @@ " Language: BibTeX (bibliographic database format for (La)TeX) " Maintainer: Bernd Feige <Bernd.Feige@gmx.net> " Filenames: *.bib -" Last Change: 2014 Mar 26 +" Last Change: 2016 May 31 " Thanks to those who pointed out problems with this file or supplied fixes! @@ -35,8 +35,40 @@ syn keyword bibEntryKw contained crossref edition editor howpublished syn keyword bibEntryKw contained institution journal key month note syn keyword bibEntryKw contained number organization pages publisher syn keyword bibEntryKw contained school series title type volume year + +" biblatex keywords, cf. http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf +syn keyword bibType contained mvbook bookinbook suppbook collection mvcollection suppcollection +syn keyword bibType contained online patent periodical suppperiodical mvproceedings reference +syn keyword bibType contained mvreference inreference report set thesis xdata customa customb +syn keyword bibType contained customc customd custome customf electronic www artwork audio bibnote +syn keyword bibType contained commentary image jurisdiction legislation legal letter movie music +syn keyword bibType contained performance review software standard video + +syn keyword bibEntryKw contained abstract isbn issn keywords url +syn keyword bibEntryKw contained addendum afterwordannotation annotation annotator authortype +syn keyword bibEntryKw contained bookauthor bookpagination booksubtitle booktitleaddon +syn keyword bibEntryKw contained commentator date doi editora editorb editorc editortype +syn keyword bibEntryKw contained editoratype editorbtype editorctype eid entrysubtype +syn keyword bibEntryKw contained eprint eprintclass eprinttype eventdate eventtitle +syn keyword bibEntryKw contained eventtitleaddon file foreword holder indextitle +syn keyword bibEntryKw contained introduction isan ismn isrn issue issuesubtitle +syn keyword bibEntryKw contained issuetitle iswc journalsubtitle journaltitle label +syn keyword bibEntryKw contained language library location mainsubtitle maintitle +syn keyword bibEntryKw contained maintitleaddon nameaddon origdate origlanguage +syn keyword bibEntryKw contained origlocation origpublisher origtitle pagetotal +syn keyword bibEntryKw contained pagination part pubstate reprinttitle shortauthor +syn keyword bibEntryKw contained shorteditor shorthand shorthandintro shortjournal +syn keyword bibEntryKw contained shortseries shorttitle subtitle titleaddon translator +syn keyword bibEntryKw contained urldate venue version volumes entryset execute gender +syn keyword bibEntryKw contained langid langidopts ids indexsorttitle options presort +syn keyword bibEntryKw contained related relatedoptions relatedtype relatedstring +syn keyword bibEntryKw contained sortkey sortname sortshorthand sorttitle sortyear xdata +syn keyword bibEntryKw contained xref namea nameb namec nameatype namebtype namectype +syn keyword bibEntryKw contained lista listb listc listd liste listf usera userb userc +syn keyword bibEntryKw contained userd usere userf verba verbb verbc archiveprefix pdf +syn keyword bibEntryKw contained primaryclass + " Non-standard: -syn keyword bibNSEntryKw contained abstract isbn issn keywords url " AMS mref http://www.ams.org/mref syn keyword bibNSEntryKw contained mrclass mrnumber mrreviewer fjournal coden diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index ac4909edba..57d99ab1e9 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Mar 05 +" Last Change: 2016 Jul 07 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -248,6 +248,10 @@ if !exists("c_no_c99") " ISO C99 syn keyword cType _Bool bool _Complex complex _Imaginary imaginary syn keyword cType int8_t int16_t int32_t int64_t syn keyword cType uint8_t uint16_t uint32_t uint64_t + if !exists("c_no_bsd") + " These are BSD specific. + syn keyword cType u_int8_t u_int16_t u_int32_t u_int64_t + endif syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t @@ -264,7 +268,7 @@ syn keyword cStorageClass static register auto volatile extern const if exists("c_gnu") syn keyword cStorageClass inline __attribute__ endif -if !exists("c_no_c99") +if !exists("c_no_c99") && s:ft !=# 'cpp' syn keyword cStorageClass inline restrict endif if !exists("c_no_c11") @@ -291,7 +295,7 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX if !exists("c_no_c99") - syn keyword cConstant __func__ + syn keyword cConstant __func__ __VA_ARGS__ syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX diff --git a/runtime/syntax/clojure.vim b/runtime/syntax/clojure.vim index 4dc1cde05c..2b48146b5a 100644 --- a/runtime/syntax/clojure.vim +++ b/runtime/syntax/clojure.vim @@ -1,37 +1,68 @@ " Vim syntax file -" Language: Clojure -" Authors: Toralf Wittner <toralf.wittner@gmail.com> -" modified by Meikel Brandmeyer <mb@kotka.de> -" URL: http://kotka.de/projects/clojure/vimclojure.html +" Language: Clojure +" Authors: Toralf Wittner <toralf.wittner@gmail.com> +" modified by Meikel Brandmeyer <mb@kotka.de> +" URL: http://kotka.de/projects/clojure/vimclojure.html " -" Contributors: Joel Holdbrooks <cjholdbrooks@gmail.com> (Regexp support, bug fixes) +" Contributors: Joel Holdbrooks <cjholdbrooks@gmail.com> (Regexp support, bug fixes) " -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 if exists("b:current_syntax") finish endif +let s:cpo_sav = &cpo +set cpo&vim + if has("folding") && exists("g:clojure_fold") && g:clojure_fold > 0 setlocal foldmethod=syntax endif " -*- KEYWORDS -*- -" 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 -syntax keyword clojureConstant nil -syntax keyword clojureBoolean false true -syntax keyword clojureSpecial . catch clojure.core/fn clojure.core/let clojure.core/loop def do finally fn if let loop monitor-enter monitor-exit new quote recur set! throw try var -syntax keyword clojureException catch finally throw try -syntax keyword clojureCond case clojure.core/case clojure.core/cond clojure.core/cond-> clojure.core/cond->> clojure.core/condp clojure.core/if-let clojure.core/if-not clojure.core/if-some clojure.core/when clojure.core/when-first clojure.core/when-let clojure.core/when-not clojure.core/when-some cond cond-> cond->> condp if-let if-not if-some when when-first when-let when-not when-some -syntax keyword clojureRepeat clojure.core/doseq clojure.core/dotimes clojure.core/while doseq dotimes while -syntax keyword clojureDefine clojure.core/definline clojure.core/definterface clojure.core/defmacro clojure.core/defmethod clojure.core/defmulti clojure.core/defn clojure.core/defn- clojure.core/defonce clojure.core/defprotocol clojure.core/defrecord clojure.core/defstruct clojure.core/deftype definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype -syntax keyword clojureMacro -> ->> .. amap and areduce as-> assert binding bound-fn clojure.core/-> clojure.core/->> clojure.core/.. clojure.core/amap clojure.core/and clojure.core/areduce clojure.core/as-> clojure.core/assert clojure.core/binding clojure.core/bound-fn clojure.core/comment clojure.core/declare clojure.core/delay clojure.core/dosync clojure.core/doto clojure.core/extend-protocol clojure.core/extend-type clojure.core/for clojure.core/future clojure.core/gen-class clojure.core/gen-interface clojure.core/import clojure.core/io! clojure.core/lazy-cat clojure.core/lazy-seq clojure.core/letfn clojure.core/locking clojure.core/memfn clojure.core/ns clojure.core/or clojure.core/proxy clojure.core/proxy-super clojure.core/pvalues clojure.core/refer-clojure clojure.core/reify clojure.core/some-> clojure.core/some->> clojure.core/sync clojure.core/time clojure.core/with-bindings clojure.core/with-in-str clojure.core/with-loading-context clojure.core/with-local-vars clojure.core/with-open clojure.core/with-out-str clojure.core/with-precision clojure.core/with-redefs comment declare delay dosync doto extend-protocol extend-type for future gen-class gen-interface import io! lazy-cat lazy-seq letfn locking memfn ns or proxy proxy-super pvalues refer-clojure reify some-> some->> sync time with-bindings with-in-str with-loading-context with-local-vars with-open with-out-str with-precision with-redefs -syntax keyword clojureFunc * *' + +' - -' ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods / < <= = == > >= accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root ancestors apply array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger 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? butlast byte byte-array bytes cast char char-array char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version clojure.core/* clojure.core/*' clojure.core/+ clojure.core/+' clojure.core/- clojure.core/-' clojure.core/->ArrayChunk clojure.core/->Vec clojure.core/->VecNode clojure.core/->VecSeq clojure.core/-cache-protocol-fn clojure.core/-reset-methods clojure.core// clojure.core/< clojure.core/<= clojure.core/= clojure.core/== clojure.core/> clojure.core/>= clojure.core/accessor clojure.core/aclone clojure.core/add-classpath clojure.core/add-watch clojure.core/agent clojure.core/agent-error clojure.core/agent-errors clojure.core/aget clojure.core/alength clojure.core/alias clojure.core/all-ns clojure.core/alter clojure.core/alter-meta! clojure.core/alter-var-root clojure.core/ancestors clojure.core/apply clojure.core/array-map clojure.core/aset clojure.core/aset-boolean clojure.core/aset-byte clojure.core/aset-char clojure.core/aset-double clojure.core/aset-float clojure.core/aset-int clojure.core/aset-long clojure.core/aset-short clojure.core/assoc clojure.core/assoc! clojure.core/assoc-in clojure.core/associative? clojure.core/atom clojure.core/await clojure.core/await-for clojure.core/await1 clojure.core/bases clojure.core/bean clojure.core/bigdec clojure.core/bigint clojure.core/biginteger clojure.core/bit-and clojure.core/bit-and-not clojure.core/bit-clear clojure.core/bit-flip clojure.core/bit-not clojure.core/bit-or clojure.core/bit-set clojure.core/bit-shift-left clojure.core/bit-shift-right clojure.core/bit-test clojure.core/bit-xor clojure.core/boolean clojure.core/boolean-array clojure.core/booleans clojure.core/bound-fn* clojure.core/bound? clojure.core/butlast clojure.core/byte clojure.core/byte-array clojure.core/bytes clojure.core/cast clojure.core/char clojure.core/char-array clojure.core/char? clojure.core/chars clojure.core/chunk clojure.core/chunk-append clojure.core/chunk-buffer clojure.core/chunk-cons clojure.core/chunk-first clojure.core/chunk-next clojure.core/chunk-rest clojure.core/chunked-seq? clojure.core/class clojure.core/class? clojure.core/clear-agent-errors clojure.core/clojure-version clojure.core/coll? clojure.core/commute clojure.core/comp clojure.core/comparator clojure.core/compare clojure.core/compare-and-set! clojure.core/compile clojure.core/complement clojure.core/concat clojure.core/conj clojure.core/conj! clojure.core/cons clojure.core/constantly clojure.core/construct-proxy clojure.core/contains? clojure.core/count clojure.core/counted? clojure.core/create-ns clojure.core/create-struct clojure.core/cycle clojure.core/dec clojure.core/dec' clojure.core/decimal? clojure.core/delay? clojure.core/deliver clojure.core/denominator clojure.core/deref clojure.core/derive clojure.core/descendants clojure.core/destructure clojure.core/disj clojure.core/disj! clojure.core/dissoc clojure.core/dissoc! clojure.core/distinct clojure.core/distinct? clojure.core/doall clojure.core/dorun clojure.core/double clojure.core/double-array clojure.core/doubles clojure.core/drop clojure.core/drop-last clojure.core/drop-while clojure.core/empty clojure.core/empty? clojure.core/ensure clojure.core/enumeration-seq clojure.core/error-handler clojure.core/error-mode clojure.core/eval clojure.core/even? clojure.core/every-pred clojure.core/every? clojure.core/ex-data clojure.core/ex-info clojure.core/extend clojure.core/extenders clojure.core/extends? clojure.core/false? clojure.core/ffirst clojure.core/file-seq clojure.core/filter clojure.core/filterv clojure.core/find clojure.core/find-keyword clojure.core/find-ns clojure.core/find-protocol-impl clojure.core/find-protocol-method clojure.core/find-var clojure.core/first clojure.core/flatten clojure.core/float clojure.core/float-array clojure.core/float? clojure.core/floats clojure.core/flush clojure.core/fn? clojure.core/fnext clojure.core/fnil clojure.core/force clojure.core/format clojure.core/frequencies clojure.core/future-call clojure.core/future-cancel clojure.core/future-cancelled? clojure.core/future-done? clojure.core/future? clojure.core/gensym clojure.core/get clojure.core/get-in clojure.core/get-method clojure.core/get-proxy-class clojure.core/get-thread-bindings clojure.core/get-validator clojure.core/group-by clojure.core/hash clojure.core/hash-combine clojure.core/hash-map clojure.core/hash-ordered-coll clojure.core/hash-set clojure.core/hash-unordered-coll clojure.core/identical? clojure.core/identity clojure.core/ifn? clojure.core/in-ns clojure.core/inc clojure.core/inc' clojure.core/init-proxy clojure.core/instance? clojure.core/int clojure.core/int-array clojure.core/integer? clojure.core/interleave clojure.core/intern clojure.core/interpose clojure.core/into clojure.core/into-array clojure.core/ints clojure.core/isa? clojure.core/iterate clojure.core/iterator-seq clojure.core/juxt clojure.core/keep clojure.core/keep-indexed clojure.core/key clojure.core/keys clojure.core/keyword clojure.core/keyword? clojure.core/last clojure.core/line-seq clojure.core/list clojure.core/list* clojure.core/list? clojure.core/load clojure.core/load-file clojure.core/load-reader clojure.core/load-string clojure.core/loaded-libs clojure.core/long clojure.core/long-array clojure.core/longs clojure.core/macroexpand clojure.core/macroexpand-1 clojure.core/make-array clojure.core/make-hierarchy clojure.core/map clojure.core/map-indexed clojure.core/map? clojure.core/mapcat clojure.core/mapv clojure.core/max clojure.core/max-key clojure.core/memoize clojure.core/merge clojure.core/merge-with clojure.core/meta clojure.core/method-sig clojure.core/methods clojure.core/min clojure.core/min-key clojure.core/mix-collection-hash clojure.core/mod clojure.core/munge clojure.core/name clojure.core/namespace clojure.core/namespace-munge clojure.core/neg? clojure.core/newline clojure.core/next clojure.core/nfirst clojure.core/nil? clojure.core/nnext clojure.core/not clojure.core/not-any? clojure.core/not-empty clojure.core/not-every? clojure.core/not= clojure.core/ns-aliases clojure.core/ns-imports clojure.core/ns-interns clojure.core/ns-map clojure.core/ns-name clojure.core/ns-publics clojure.core/ns-refers clojure.core/ns-resolve clojure.core/ns-unalias clojure.core/ns-unmap clojure.core/nth clojure.core/nthnext clojure.core/nthrest clojure.core/num clojure.core/number? clojure.core/numerator clojure.core/object-array clojure.core/odd? clojure.core/parents clojure.core/partial clojure.core/partition clojure.core/partition-all clojure.core/partition-by clojure.core/pcalls clojure.core/peek clojure.core/persistent! clojure.core/pmap clojure.core/pop clojure.core/pop! clojure.core/pop-thread-bindings clojure.core/pos? clojure.core/pr clojure.core/pr-str clojure.core/prefer-method clojure.core/prefers clojure.core/print clojure.core/print-ctor clojure.core/print-dup clojure.core/print-method clojure.core/print-simple clojure.core/print-str clojure.core/printf clojure.core/println clojure.core/println-str clojure.core/prn clojure.core/prn-str clojure.core/promise clojure.core/proxy-call-with-super clojure.core/proxy-mappings clojure.core/proxy-name clojure.core/push-thread-bindings clojure.core/quot clojure.core/rand clojure.core/rand-int clojure.core/rand-nth clojure.core/range clojure.core/ratio? clojure.core/rational? clojure.core/rationalize clojure.core/re-find clojure.core/re-groups clojure.core/re-matcher clojure.core/re-matches clojure.core/re-pattern clojure.core/re-seq clojure.core/read clojure.core/read-line clojure.core/read-string clojure.core/realized? clojure.core/record? clojure.core/reduce clojure.core/reduce-kv clojure.core/reduced clojure.core/reduced? clojure.core/reductions clojure.core/ref clojure.core/ref-history-count clojure.core/ref-max-history clojure.core/ref-min-history clojure.core/ref-set clojure.core/refer clojure.core/release-pending-sends clojure.core/rem clojure.core/remove clojure.core/remove-all-methods clojure.core/remove-method clojure.core/remove-ns clojure.core/remove-watch clojure.core/repeat clojure.core/repeatedly clojure.core/replace clojure.core/replicate clojure.core/require clojure.core/reset! clojure.core/reset-meta! clojure.core/resolve clojure.core/rest clojure.core/restart-agent clojure.core/resultset-seq clojure.core/reverse clojure.core/reversible? clojure.core/rseq clojure.core/rsubseq clojure.core/satisfies? clojure.core/second clojure.core/select-keys clojure.core/send clojure.core/send-off clojure.core/send-via clojure.core/seq clojure.core/seq? clojure.core/seque clojure.core/sequence clojure.core/sequential? clojure.core/set clojure.core/set-agent-send-executor! clojure.core/set-agent-send-off-executor! clojure.core/set-error-handler! clojure.core/set-error-mode! clojure.core/set-validator! clojure.core/set? clojure.core/short clojure.core/short-array clojure.core/shorts clojure.core/shuffle clojure.core/shutdown-agents clojure.core/slurp clojure.core/some clojure.core/some-fn clojure.core/some? clojure.core/sort clojure.core/sort-by clojure.core/sorted-map clojure.core/sorted-map-by clojure.core/sorted-set clojure.core/sorted-set-by clojure.core/sorted? clojure.core/special-symbol? clojure.core/spit clojure.core/split-at clojure.core/split-with clojure.core/str clojure.core/string? clojure.core/struct clojure.core/struct-map clojure.core/subs clojure.core/subseq clojure.core/subvec clojure.core/supers clojure.core/swap! clojure.core/symbol clojure.core/symbol? clojure.core/take clojure.core/take-last clojure.core/take-nth clojure.core/take-while clojure.core/test clojure.core/the-ns clojure.core/thread-bound? clojure.core/to-array clojure.core/to-array-2d clojure.core/trampoline clojure.core/transient clojure.core/tree-seq clojure.core/true? clojure.core/type clojure.core/unchecked-add clojure.core/unchecked-add-int clojure.core/unchecked-byte clojure.core/unchecked-char clojure.core/unchecked-dec clojure.core/unchecked-dec-int clojure.core/unchecked-divide-int clojure.core/unchecked-double clojure.core/unchecked-float clojure.core/unchecked-inc clojure.core/unchecked-inc-int clojure.core/unchecked-int clojure.core/unchecked-long clojure.core/unchecked-multiply clojure.core/unchecked-multiply-int clojure.core/unchecked-negate clojure.core/unchecked-negate-int clojure.core/unchecked-remainder-int clojure.core/unchecked-short clojure.core/unchecked-subtract clojure.core/unchecked-subtract-int clojure.core/underive clojure.core/unsigned-bit-shift-right clojure.core/update-in clojure.core/update-proxy clojure.core/use clojure.core/val clojure.core/vals clojure.core/var-get clojure.core/var-set clojure.core/var? clojure.core/vary-meta clojure.core/vec clojure.core/vector clojure.core/vector-of clojure.core/vector? clojure.core/with-bindings* clojure.core/with-meta clojure.core/with-redefs-fn clojure.core/xml-seq clojure.core/zero? clojure.core/zipmap coll? commute comp comparator compare compare-and-set! compile complement concat conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun 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 extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn? fnext fnil force format frequencies future-call future-cancel future-cancelled? future-done? future? 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 ifn? in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last line-seq list list* list? load load-file load-reader load-string loaded-libs long long-array longs macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memoize merge merge-with meta method-sig methods min min-key mix-collection-hash mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= 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? parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy-call-with-super proxy-mappings proxy-name push-thread-bindings quot 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? reduce reduce-kv reduced reduced? reductions ref ref-history-count ref-max-history ref-min-history ref-set refer 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-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-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? take take-last take-nth take-while test the-ns thread-bound? to-array to-array-2d trampoline transient tree-seq true? 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 unsigned-bit-shift-right update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? with-bindings* with-meta with-redefs-fn xml-seq zero? zipmap -syntax keyword clojureVariable *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* EMPTY-NODE char-escape-string char-name-string clojure.core/*1 clojure.core/*2 clojure.core/*3 clojure.core/*agent* clojure.core/*allow-unresolved-vars* clojure.core/*assert* clojure.core/*clojure-version* clojure.core/*command-line-args* clojure.core/*compile-files* clojure.core/*compile-path* clojure.core/*compiler-options* clojure.core/*data-readers* clojure.core/*default-data-reader-fn* clojure.core/*e clojure.core/*err* clojure.core/*file* clojure.core/*flush-on-newline* clojure.core/*fn-loader* clojure.core/*in* clojure.core/*math-context* clojure.core/*ns* clojure.core/*out* clojure.core/*print-dup* clojure.core/*print-length* clojure.core/*print-level* clojure.core/*print-meta* clojure.core/*print-readably* clojure.core/*read-eval* clojure.core/*source-path* clojure.core/*unchecked-math* clojure.core/*use-context-classloader* clojure.core/*verbose-defrecords* clojure.core/*warn-on-reflection* clojure.core/EMPTY-NODE clojure.core/char-escape-string clojure.core/char-name-string clojure.core/default-data-readers clojure.core/primitives-classnames clojure.core/unquote clojure.core/unquote-splicing default-data-readers primitives-classnames unquote unquote-splicing +" 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:clojure_syntax_keywords = { + \ 'clojureBoolean': ["false","true"] + \ , 'clojureCond': ["case","clojure.core/case","clojure.core/cond","clojure.core/cond->","clojure.core/cond->>","clojure.core/condp","clojure.core/if-let","clojure.core/if-not","clojure.core/if-some","clojure.core/when","clojure.core/when-first","clojure.core/when-let","clojure.core/when-not","clojure.core/when-some","cond","cond->","cond->>","condp","if-let","if-not","if-some","when","when-first","when-let","when-not","when-some"] + \ , 'clojureConstant': ["nil"] + \ , 'clojureDefine': ["clojure.core/definline","clojure.core/definterface","clojure.core/defmacro","clojure.core/defmethod","clojure.core/defmulti","clojure.core/defn","clojure.core/defn-","clojure.core/defonce","clojure.core/defprotocol","clojure.core/defrecord","clojure.core/defstruct","clojure.core/deftype","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype"] + \ , 'clojureException': ["catch","finally","throw","try"] + \ , 'clojureFunc': ["*","*'","+","+'","-","-'","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods","/","<","<=","=","==",">",">=","Throwable->map","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","ancestors","apply","array-map","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","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?","butlast","byte","byte-array","bytes","cast","cat","char","char-array","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","clojure.core/*","clojure.core/*'","clojure.core/+","clojure.core/+'","clojure.core/-","clojure.core/-'","clojure.core/->ArrayChunk","clojure.core/->Eduction","clojure.core/->Vec","clojure.core/->VecNode","clojure.core/->VecSeq","clojure.core/-cache-protocol-fn","clojure.core/-reset-methods","clojure.core//","clojure.core/<","clojure.core/<=","clojure.core/=","clojure.core/==","clojure.core/>","clojure.core/>=","clojure.core/Throwable->map","clojure.core/accessor","clojure.core/aclone","clojure.core/add-classpath","clojure.core/add-watch","clojure.core/agent","clojure.core/agent-error","clojure.core/agent-errors","clojure.core/aget","clojure.core/alength","clojure.core/alias","clojure.core/all-ns","clojure.core/alter","clojure.core/alter-meta!","clojure.core/alter-var-root","clojure.core/ancestors","clojure.core/apply","clojure.core/array-map","clojure.core/aset","clojure.core/aset-boolean","clojure.core/aset-byte","clojure.core/aset-char","clojure.core/aset-double","clojure.core/aset-float","clojure.core/aset-int","clojure.core/aset-long","clojure.core/aset-short","clojure.core/assoc","clojure.core/assoc!","clojure.core/assoc-in","clojure.core/associative?","clojure.core/atom","clojure.core/await","clojure.core/await-for","clojure.core/await1","clojure.core/bases","clojure.core/bean","clojure.core/bigdec","clojure.core/bigint","clojure.core/biginteger","clojure.core/bit-and","clojure.core/bit-and-not","clojure.core/bit-clear","clojure.core/bit-flip","clojure.core/bit-not","clojure.core/bit-or","clojure.core/bit-set","clojure.core/bit-shift-left","clojure.core/bit-shift-right","clojure.core/bit-test","clojure.core/bit-xor","clojure.core/boolean","clojure.core/boolean-array","clojure.core/booleans","clojure.core/bound-fn*","clojure.core/bound?","clojure.core/butlast","clojure.core/byte","clojure.core/byte-array","clojure.core/bytes","clojure.core/cast","clojure.core/cat","clojure.core/char","clojure.core/char-array","clojure.core/char?","clojure.core/chars","clojure.core/chunk","clojure.core/chunk-append","clojure.core/chunk-buffer","clojure.core/chunk-cons","clojure.core/chunk-first","clojure.core/chunk-next","clojure.core/chunk-rest","clojure.core/chunked-seq?","clojure.core/class","clojure.core/class?","clojure.core/clear-agent-errors","clojure.core/clojure-version","clojure.core/coll?","clojure.core/commute","clojure.core/comp","clojure.core/comparator","clojure.core/compare","clojure.core/compare-and-set!","clojure.core/compile","clojure.core/complement","clojure.core/completing","clojure.core/concat","clojure.core/conj","clojure.core/conj!","clojure.core/cons","clojure.core/constantly","clojure.core/construct-proxy","clojure.core/contains?","clojure.core/count","clojure.core/counted?","clojure.core/create-ns","clojure.core/create-struct","clojure.core/cycle","clojure.core/dec","clojure.core/dec'","clojure.core/decimal?","clojure.core/dedupe","clojure.core/delay?","clojure.core/deliver","clojure.core/denominator","clojure.core/deref","clojure.core/derive","clojure.core/descendants","clojure.core/destructure","clojure.core/disj","clojure.core/disj!","clojure.core/dissoc","clojure.core/dissoc!","clojure.core/distinct","clojure.core/distinct?","clojure.core/doall","clojure.core/dorun","clojure.core/double","clojure.core/double-array","clojure.core/doubles","clojure.core/drop","clojure.core/drop-last","clojure.core/drop-while","clojure.core/eduction","clojure.core/empty","clojure.core/empty?","clojure.core/ensure","clojure.core/ensure-reduced","clojure.core/enumeration-seq","clojure.core/error-handler","clojure.core/error-mode","clojure.core/eval","clojure.core/even?","clojure.core/every-pred","clojure.core/every?","clojure.core/ex-data","clojure.core/ex-info","clojure.core/extend","clojure.core/extenders","clojure.core/extends?","clojure.core/false?","clojure.core/ffirst","clojure.core/file-seq","clojure.core/filter","clojure.core/filterv","clojure.core/find","clojure.core/find-keyword","clojure.core/find-ns","clojure.core/find-protocol-impl","clojure.core/find-protocol-method","clojure.core/find-var","clojure.core/first","clojure.core/flatten","clojure.core/float","clojure.core/float-array","clojure.core/float?","clojure.core/floats","clojure.core/flush","clojure.core/fn?","clojure.core/fnext","clojure.core/fnil","clojure.core/force","clojure.core/format","clojure.core/frequencies","clojure.core/future-call","clojure.core/future-cancel","clojure.core/future-cancelled?","clojure.core/future-done?","clojure.core/future?","clojure.core/gensym","clojure.core/get","clojure.core/get-in","clojure.core/get-method","clojure.core/get-proxy-class","clojure.core/get-thread-bindings","clojure.core/get-validator","clojure.core/group-by","clojure.core/hash","clojure.core/hash-combine","clojure.core/hash-map","clojure.core/hash-ordered-coll","clojure.core/hash-set","clojure.core/hash-unordered-coll","clojure.core/identical?","clojure.core/identity","clojure.core/ifn?","clojure.core/in-ns","clojure.core/inc","clojure.core/inc'","clojure.core/init-proxy","clojure.core/instance?","clojure.core/int","clojure.core/int-array","clojure.core/integer?","clojure.core/interleave","clojure.core/intern","clojure.core/interpose","clojure.core/into","clojure.core/into-array","clojure.core/ints","clojure.core/isa?","clojure.core/iterate","clojure.core/iterator-seq","clojure.core/juxt","clojure.core/keep","clojure.core/keep-indexed","clojure.core/key","clojure.core/keys","clojure.core/keyword","clojure.core/keyword?","clojure.core/last","clojure.core/line-seq","clojure.core/list","clojure.core/list*","clojure.core/list?","clojure.core/load","clojure.core/load-file","clojure.core/load-reader","clojure.core/load-string","clojure.core/loaded-libs","clojure.core/long","clojure.core/long-array","clojure.core/longs","clojure.core/macroexpand","clojure.core/macroexpand-1","clojure.core/make-array","clojure.core/make-hierarchy","clojure.core/map","clojure.core/map-entry?","clojure.core/map-indexed","clojure.core/map?","clojure.core/mapcat","clojure.core/mapv","clojure.core/max","clojure.core/max-key","clojure.core/memoize","clojure.core/merge","clojure.core/merge-with","clojure.core/meta","clojure.core/method-sig","clojure.core/methods","clojure.core/min","clojure.core/min-key","clojure.core/mix-collection-hash","clojure.core/mod","clojure.core/munge","clojure.core/name","clojure.core/namespace","clojure.core/namespace-munge","clojure.core/neg?","clojure.core/newline","clojure.core/next","clojure.core/nfirst","clojure.core/nil?","clojure.core/nnext","clojure.core/not","clojure.core/not-any?","clojure.core/not-empty","clojure.core/not-every?","clojure.core/not=","clojure.core/ns-aliases","clojure.core/ns-imports","clojure.core/ns-interns","clojure.core/ns-map","clojure.core/ns-name","clojure.core/ns-publics","clojure.core/ns-refers","clojure.core/ns-resolve","clojure.core/ns-unalias","clojure.core/ns-unmap","clojure.core/nth","clojure.core/nthnext","clojure.core/nthrest","clojure.core/num","clojure.core/number?","clojure.core/numerator","clojure.core/object-array","clojure.core/odd?","clojure.core/parents","clojure.core/partial","clojure.core/partition","clojure.core/partition-all","clojure.core/partition-by","clojure.core/pcalls","clojure.core/peek","clojure.core/persistent!","clojure.core/pmap","clojure.core/pop","clojure.core/pop!","clojure.core/pop-thread-bindings","clojure.core/pos?","clojure.core/pr","clojure.core/pr-str","clojure.core/prefer-method","clojure.core/prefers","clojure.core/print","clojure.core/print-ctor","clojure.core/print-dup","clojure.core/print-method","clojure.core/print-simple","clojure.core/print-str","clojure.core/printf","clojure.core/println","clojure.core/println-str","clojure.core/prn","clojure.core/prn-str","clojure.core/promise","clojure.core/proxy-call-with-super","clojure.core/proxy-mappings","clojure.core/proxy-name","clojure.core/push-thread-bindings","clojure.core/quot","clojure.core/rand","clojure.core/rand-int","clojure.core/rand-nth","clojure.core/random-sample","clojure.core/range","clojure.core/ratio?","clojure.core/rational?","clojure.core/rationalize","clojure.core/re-find","clojure.core/re-groups","clojure.core/re-matcher","clojure.core/re-matches","clojure.core/re-pattern","clojure.core/re-seq","clojure.core/read","clojure.core/read-line","clojure.core/read-string","clojure.core/reader-conditional","clojure.core/reader-conditional?","clojure.core/realized?","clojure.core/record?","clojure.core/reduce","clojure.core/reduce-kv","clojure.core/reduced","clojure.core/reduced?","clojure.core/reductions","clojure.core/ref","clojure.core/ref-history-count","clojure.core/ref-max-history","clojure.core/ref-min-history","clojure.core/ref-set","clojure.core/refer","clojure.core/release-pending-sends","clojure.core/rem","clojure.core/remove","clojure.core/remove-all-methods","clojure.core/remove-method","clojure.core/remove-ns","clojure.core/remove-watch","clojure.core/repeat","clojure.core/repeatedly","clojure.core/replace","clojure.core/replicate","clojure.core/require","clojure.core/reset!","clojure.core/reset-meta!","clojure.core/resolve","clojure.core/rest","clojure.core/restart-agent","clojure.core/resultset-seq","clojure.core/reverse","clojure.core/reversible?","clojure.core/rseq","clojure.core/rsubseq","clojure.core/run!","clojure.core/satisfies?","clojure.core/second","clojure.core/select-keys","clojure.core/send","clojure.core/send-off","clojure.core/send-via","clojure.core/seq","clojure.core/seq?","clojure.core/seque","clojure.core/sequence","clojure.core/sequential?","clojure.core/set","clojure.core/set-agent-send-executor!","clojure.core/set-agent-send-off-executor!","clojure.core/set-error-handler!","clojure.core/set-error-mode!","clojure.core/set-validator!","clojure.core/set?","clojure.core/short","clojure.core/short-array","clojure.core/shorts","clojure.core/shuffle","clojure.core/shutdown-agents","clojure.core/slurp","clojure.core/some","clojure.core/some-fn","clojure.core/some?","clojure.core/sort","clojure.core/sort-by","clojure.core/sorted-map","clojure.core/sorted-map-by","clojure.core/sorted-set","clojure.core/sorted-set-by","clojure.core/sorted?","clojure.core/special-symbol?","clojure.core/spit","clojure.core/split-at","clojure.core/split-with","clojure.core/str","clojure.core/string?","clojure.core/struct","clojure.core/struct-map","clojure.core/subs","clojure.core/subseq","clojure.core/subvec","clojure.core/supers","clojure.core/swap!","clojure.core/symbol","clojure.core/symbol?","clojure.core/tagged-literal","clojure.core/tagged-literal?","clojure.core/take","clojure.core/take-last","clojure.core/take-nth","clojure.core/take-while","clojure.core/test","clojure.core/the-ns","clojure.core/thread-bound?","clojure.core/to-array","clojure.core/to-array-2d","clojure.core/trampoline","clojure.core/transduce","clojure.core/transient","clojure.core/tree-seq","clojure.core/true?","clojure.core/type","clojure.core/unchecked-add","clojure.core/unchecked-add-int","clojure.core/unchecked-byte","clojure.core/unchecked-char","clojure.core/unchecked-dec","clojure.core/unchecked-dec-int","clojure.core/unchecked-divide-int","clojure.core/unchecked-double","clojure.core/unchecked-float","clojure.core/unchecked-inc","clojure.core/unchecked-inc-int","clojure.core/unchecked-int","clojure.core/unchecked-long","clojure.core/unchecked-multiply","clojure.core/unchecked-multiply-int","clojure.core/unchecked-negate","clojure.core/unchecked-negate-int","clojure.core/unchecked-remainder-int","clojure.core/unchecked-short","clojure.core/unchecked-subtract","clojure.core/unchecked-subtract-int","clojure.core/underive","clojure.core/unreduced","clojure.core/unsigned-bit-shift-right","clojure.core/update","clojure.core/update-in","clojure.core/update-proxy","clojure.core/use","clojure.core/val","clojure.core/vals","clojure.core/var-get","clojure.core/var-set","clojure.core/var?","clojure.core/vary-meta","clojure.core/vec","clojure.core/vector","clojure.core/vector-of","clojure.core/vector?","clojure.core/volatile!","clojure.core/volatile?","clojure.core/vreset!","clojure.core/with-bindings*","clojure.core/with-meta","clojure.core/with-redefs-fn","clojure.core/xml-seq","clojure.core/zero?","clojure.core/zipmap","coll?","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","dedupe","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","doall","dorun","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","extenders","extends?","false?","ffirst","file-seq","filter","filterv","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn?","fnext","fnil","force","format","frequencies","future-call","future-cancel","future-cancelled?","future-done?","future?","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","ifn?","in-ns","inc","inc'","init-proxy","instance?","int","int-array","integer?","interleave","intern","interpose","into","into-array","ints","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","long","long-array","longs","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","munge","name","namespace","namespace-munge","neg?","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","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?","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos?","pr","pr-str","prefer-method","prefers","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy-call-with-super","proxy-mappings","proxy-name","push-thread-bindings","quot","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?","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","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-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-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?","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","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","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","use","val","vals","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","with-bindings*","with-meta","with-redefs-fn","xml-seq","zero?","zipmap"] + \ , 'clojureMacro': ["->","->>","..","amap","and","areduce","as->","assert","binding","bound-fn","clojure.core/->","clojure.core/->>","clojure.core/..","clojure.core/amap","clojure.core/and","clojure.core/areduce","clojure.core/as->","clojure.core/assert","clojure.core/binding","clojure.core/bound-fn","clojure.core/comment","clojure.core/declare","clojure.core/delay","clojure.core/dosync","clojure.core/doto","clojure.core/extend-protocol","clojure.core/extend-type","clojure.core/for","clojure.core/future","clojure.core/gen-class","clojure.core/gen-interface","clojure.core/import","clojure.core/io!","clojure.core/lazy-cat","clojure.core/lazy-seq","clojure.core/letfn","clojure.core/locking","clojure.core/memfn","clojure.core/ns","clojure.core/or","clojure.core/proxy","clojure.core/proxy-super","clojure.core/pvalues","clojure.core/refer-clojure","clojure.core/reify","clojure.core/some->","clojure.core/some->>","clojure.core/sync","clojure.core/time","clojure.core/vswap!","clojure.core/with-bindings","clojure.core/with-in-str","clojure.core/with-loading-context","clojure.core/with-local-vars","clojure.core/with-open","clojure.core/with-out-str","clojure.core/with-precision","clojure.core/with-redefs","comment","declare","delay","dosync","doto","extend-protocol","extend-type","for","future","gen-class","gen-interface","import","io!","lazy-cat","lazy-seq","letfn","locking","memfn","ns","or","proxy","proxy-super","pvalues","refer-clojure","reify","some->","some->>","sync","time","vswap!","with-bindings","with-in-str","with-loading-context","with-local-vars","with-open","with-out-str","with-precision","with-redefs"] + \ , 'clojureRepeat': ["clojure.core/doseq","clojure.core/dotimes","clojure.core/while","doseq","dotimes","while"] + \ , 'clojureSpecial': [".","clojure.core/fn","clojure.core/let","clojure.core/loop","def","do","fn","if","let","loop","monitor-enter","monitor-exit","new","quote","recur","set!","var"] + \ , 'clojureVariable': ["*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*","EMPTY-NODE","char-escape-string","char-name-string","clojure.core/*1","clojure.core/*2","clojure.core/*3","clojure.core/*agent*","clojure.core/*allow-unresolved-vars*","clojure.core/*assert*","clojure.core/*clojure-version*","clojure.core/*command-line-args*","clojure.core/*compile-files*","clojure.core/*compile-path*","clojure.core/*compiler-options*","clojure.core/*data-readers*","clojure.core/*default-data-reader-fn*","clojure.core/*e","clojure.core/*err*","clojure.core/*file*","clojure.core/*flush-on-newline*","clojure.core/*fn-loader*","clojure.core/*in*","clojure.core/*math-context*","clojure.core/*ns*","clojure.core/*out*","clojure.core/*print-dup*","clojure.core/*print-length*","clojure.core/*print-level*","clojure.core/*print-meta*","clojure.core/*print-readably*","clojure.core/*read-eval*","clojure.core/*source-path*","clojure.core/*suppress-read*","clojure.core/*unchecked-math*","clojure.core/*use-context-classloader*","clojure.core/*verbose-defrecords*","clojure.core/*warn-on-reflection*","clojure.core/EMPTY-NODE","clojure.core/char-escape-string","clojure.core/char-name-string","clojure.core/default-data-readers","clojure.core/primitives-classnames","clojure.core/unquote","clojure.core/unquote-splicing","default-data-readers","primitives-classnames","unquote","unquote-splicing"] + \ } + +function! s:syntax_keyword(dict) + for key in keys(a:dict) + execute 'syntax keyword' key join(a:dict[key], ' ') + endfor +endfunction + +if exists('b:clojure_syntax_without_core_keywords') && b:clojure_syntax_without_core_keywords + " Only match language specials and primitives + for s:key in ['clojureBoolean', 'clojureConstant', 'clojureException', 'clojureSpecial'] + execute 'syntax keyword' s:key join(s:clojure_syntax_keywords[s:key], ' ') + endfor +else + call s:syntax_keyword(s:clojure_syntax_keywords) +endif + +if exists('g:clojure_syntax_keywords') + call s:syntax_keyword(g:clojure_syntax_keywords) +endif + +if exists('b:clojure_syntax_keywords') + call s:syntax_keyword(b:clojure_syntax_keywords) +endif + +unlet! s:key +delfunction s:syntax_keyword " Keywords are symbols: " static Pattern symbolPat = Pattern.compile("[:]?([\\D&&[^/]].*/)?([\\D&&[^/]][^/]*)"); @@ -43,7 +74,7 @@ syntax match clojureKeyword "\v<:{1,2}%([^ \n\r\t()\[\]{}";@^`~\\%/]+/)*[^ \n\r\ syntax match clojureStringEscape "\v\\%([\\btnfr"]|u\x{4}|[0-3]\o{2}|\o{1,2})" contained -syntax region clojureString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape,@Spell +syntax region clojureString matchgroup=clojureStringDelimiter start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape,@Spell syntax match clojureCharacter "\\." syntax match clojureCharacter "\\o\%([0-3]\o\{2\}\|\o\{1,2\}\)" @@ -77,7 +108,7 @@ syntax match clojureMeta "\^" syntax match clojureDeref "@" syntax match clojureDispatch "\v#[\^'=<_]?" -" Clojure permits no more than 20 params. +" Clojure permits no more than 20 anonymous params. syntax match clojureAnonArg "%\(20\|1\d\|[1-9]\|&\)\?" syntax match clojureRegexpEscape "\v\\%([\\tnrfae.()\[\]{}^$*?+]|c\u|0[0-3]?\o{1,2}|x%(\x{2}|\{\x{1,6}\})|u\x{4})" contained display @@ -85,27 +116,27 @@ syntax region clojureRegexpQuoted start=/\\Q/ms=e+1 skip=/\\\\\|\\"/ end=/\\E/me syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained " -*- CHARACTER PROPERTY CLASSES -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj -" Java version 1.7.0_51 +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj +" Java version 1.8.0_92 syntax match clojureRegexpPosixCharClass "\v\\[pP]\{%(Cntrl|A%(l%(pha|num)|SCII)|Space|Graph|Upper|P%(rint|unct)|Blank|XDigit|Digit|Lower)\}" contained display syntax match clojureRegexpJavaCharClass "\v\\[pP]\{java%(Whitespace|JavaIdentifier%(Part|Start)|SpaceChar|Mirrored|TitleCase|I%(SOControl|de%(ographic|ntifierIgnorable))|D%(efined|igit)|U%(pperCase|nicodeIdentifier%(Part|Start))|L%(etter%(OrDigit)?|owerCase)|Alphabetic)\}" contained display -syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\cIs%(l%(owercase|etter)|hex%(digit|_digit)|w%(hite%(_space|space)|ord)|noncharacter%(_code_point|codepoint)|p%(rint|unctuation)|ideographic|graph|a%(l%(num|phabetic)|ssigned)|uppercase|titlecase|blank|digit|control)\}" contained display +syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\cIs%(l%(owercase|etter)|hex%(digit|_digit)|w%(hite%(_space|space)|ord)|noncharacter%(_code_point|codepoint)|p%(rint|unctuation)|ideographic|graph|a%(l%(num|phabetic)|ssigned)|uppercase|join%(control|_control)|titlecase|blank|digit|control)\}" contained display syntax match clojureRegexpUnicodeCharClass "\v\\[pP][NSCMZPL]" contained display syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{%(N[dlo]?|P[dcifeos]?|C[ncfos]?|M[nce]?|Z[lsp]?|S[mcko]?|L[muCDlto]?)\}" contained display syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{%(Is|gc\=|general_category\=)?%(N[dlo]?|P[dcifeos]?|C[ncfos]?|M[nce]?|Z[lsp]?|S[mcko]?|L[muCDlto]?)\}" contained display -syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(Is|sc\=|script\=)%(l%(epc%(ha)?|y%([dc]i%(an)?)|a%(t%(n|in)|na|oo?)|i%(n%(b|ear_b)|mbu?|su))|vaii?|d%(srt|e%(seret|va%(nagari)?))|g%(lag%(olitic)?|eor%(gian)?|oth%(ic)?|re%(k|ek)|u%(j%(arati|r)|r%(u|mukhi)))|u%(gar%(itic)?|nknown)|a%(r%(ab%(ic)?|m%([ni]|enian))|v%(st|estan))|e%(thi%(opic)?|gyp%(tian_hieroglyphs)?)|z%(inh|yyy|zzz)|r%(un%(ic|r)|ejang|jng)|m%(a%(nd%(aic)?|layalam)|lym|y%(anmar|mr)|tei|ong%(olian)?|eetei_mayek)|c%(a%(n%(adian_aboriginal|s)|ri%(an)?)|y%(priot|r%(l|illic))|prt|uneiform|o%(pt%(ic)?|mmon)|h%(er%(okee)?|am))|i%(n%(scriptional_pa%(rthian|hlavi)|herited)|mperial_aramaic|tal)|b%(eng%(ali)?|a%(t%(ak|k)|li%(nese)?|mum?)|ra%(i%(lle)?|h%(mi)?)|opo%(mofo)?|u%(gi%(nese)?|h%(d|id)))|o%(g%(am|ham)|r%(iya|kh|ya)|sma%(nya)?|l%(d_%(south_arabian|persian|italic|turkic)|ck|_chiki))|p%(rti|h%(oenician|li|ag%(s_pa)?|nx))|k%(h%(m%(r|er)|ar%(oshthi)?)|nda|a%(li|n%(a|nada)|takana|yah_li|ithi)|thi)|yi%(ii)?|t%(elu%(gu)?|i%(finagh|b%(t|etan))|ha%(i|a%(na)?)|a%(i_%(le|tham|viet)|g%(alog|b%(anwa)?)|vt|l[ue]|m%(il|l))|fng|glg)|x%(peo|sux)|n%(ew_tai_lue|koo?)|h%(ira%(gana)?|an%([io]|unoo|g%(ul)?)?|ebr%(ew)?)|java%(nese)?|s%(inh%(ala)?|ha%(vian|w)|a%(ur%(ashtra)?|m%(r|aritan)|rb)|y%(r%(c|iac)|lo%(ti_nagri)?)|und%(anese)?))\}" contained display -syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(In|blk\=|block\=)%(javanese|h%(a%(lfwidth%( and fullwidth forms|andfullwidthforms|_and_fullwidth_forms)|n%(unoo|gul%(compatibilityjamo|syllables|jamo%(extended\-[ab])?|_%(syllables|jamo%(_extended_[ab])?|compatibility_jamo)| %(syllables|compatibility jamo|jamo%( extended\-[ab])?))))|i%(ragana|gh%( %(private use surrogates|surrogates)|_%(private_use_surrogates|surrogates)|surrogates|privateusesurrogates))|ebrew)|i%(pa%([ _]extensions|extensions)|deographic%( description characters|_description_characters|descriptioncharacters)|nscriptional%(%([ _]pa%(rthian|hlavi))|pa%(rthian|hlavi))|mperial%(aramaic|[_ ]aramaic))|l%(e%(tterlike%([_ ]symbols|symbols)|pcha)|ow%([_ ]surrogates|surrogates)|i%(mbu|near%(_b_%(ideograms|syllabary)|b%(ideograms|syllabary)| b %(ideograms|syllabary))|su)|a%(tin%(extended%(additional|\-[dacb])| extended%( additional|\-[dacb])|\-1%(supplement| supplement)|_%(extended_%([dcb]|a%(dditional)?)|1_supplement))|o)|y[cd]ian)|b%(u%(ginese|hid)|ra%(hmi|ille%(patterns|[_ ]patterns))|o%(x%([ _]drawing|drawing)|pomofo%([ _]extended|extended)?)|lock%([ _]elements|elements)|yzantine%( musical symbols|musicalsymbols|_musical_symbols)|engali|a%(linese|mum%(supplement|[ _]supplement)?|tak|sic%([ _]latin|latin)))|e%(gyptian%([ _]hieroglyphs|hieroglyphs)|moticons|nclosed%( %(cjk letters and months|ideographic supplement|alphanumeric%( supplement|s))|cjklettersandmonths|_%(ideographic_supplement|alphanumeric%(_supplement|s)|cjk_letters_and_months)|alphanumerics%(upplement)?|ideographicsupplement)|thiopic%(supplement|_%(supplement|extended%(_a)?)| %(supplement|extended%(\-a)?)|extended%(\-a)?)?)|k%(h%(aroshthi|mer%([_ ]symbols|symbols)?)|a%(takana%(_phonetic_extensions|phoneticextensions| phonetic extensions)?|n%(gxi%([_ ]radicals|radicals)|a%(supplement|[ _]supplement)|bun|nada)|ithi|yah%([ _]li|li)))|r%(u%(nic|mi%(numeralsymbols| numeral symbols|_numeral_symbols))|ejang)|n%(umber%(forms|[ _]forms)|ko|ew%(_tai_lue|tailue| tai lue))|m%(iscellaneous%(technical|symbols%(and%(pictographs|arrows))?|mathematicalsymbols\-[ab]| %(technical|mathematical symbols\-[ab]|symbols%( and %(pictographs|arrows))?)|_%(technical|symbols%(_and_%(pictographs|arrows))?|mathematical_symbols_[ab]))|usical%([_ ]symbols|symbols)|eetei%(mayek|[_ ]mayek)|a%(ndaic|hjong%([ _]tiles|tiles)|layalam|thematical%(alphanumericsymbols| %(alphanumeric symbols|operators)|_%(alphanumeric_symbols|operators)|operators))|yanmar%(extended\-a|_extended_a| extended\-a)?|o%(difier%(_tone_letters| tone letters|toneletters)|ngolian))|d%(e%(seret|vanagari%([ _]extended|extended)?)|ingbats|omino%([ _]tiles|tiles))|yi%(syllables|%([_ ]%(syllables|radicals))|radicals|jing%(hexagramsymbols| hexagram symbols|_hexagram_symbols))|s%(havian|mall%( form variants|formvariants|_form_variants)|p%(acing%(_modifier_letters| modifier letters|modifierletters)|ecials)|a%(maritan|urashtra)|u%(p%(erscripts%(_and_subscripts|andsubscripts| and subscripts)|plementa%(ry%(_private_use_area_[ab]|privateusearea\-[ab]| private use area\-[ab])|l%(_%(arrows_[ab]|mathematical_operators|punctuation)| %(mathematical operators|punctuation|arrows\-[ab])|mathematicaloperators|punctuation|arrows\-[ab])))|rrogates_area|ndanese)|inhala|y%(riac|loti%([_ ]nagri|nagri)))|p%(h%(o%(enician|netic%( extensions%( supplement)?|extensions%(supplement)?|_extensions%(_supplement)?))|a%(istos%([ _]disc|disc)|gs[_\-]pa))|laying%(cards|[_ ]cards)|rivate%(usearea| use area|_use_area))|o%(smanya|l%([ _]chiki|d%( %(south arabian|persian|italic|turkic)|southarabian|_%(south_arabian|persian|italic|turkic)|persian|italic|turkic)|chiki)|riya|ptical%( character recognition|_character_recognition|characterrecognition)|gham)|g%(u%(jarati|rmukhi)|othic|lagolitic|e%(o%(rgian%(supplement|[ _]supplement)?|metric%(shapes|[ _]shapes))|neral%([_ ]punctuation|punctuation))|reek%( %(and coptic|extended)|andcoptic|_extended|extended)?)|c%(o%(ntrol%(pictures|[ _]pictures)|m%(bining%(diacriticalmarks%(supplement|forsymbols)?|halfmarks| %(diacritical marks%( %(supplement|for symbols))?|half marks|marks for symbols)|marksforsymbols|_%(marks_for_symbols|half_marks|diacritical_marks%(_supplement)?))|mon%(_indic_number_forms|indicnumberforms| indic number forms))|ptic|unting%( rod numerals|_rod_numerals|rodnumerals))|y%(rillic%(extended\-[ab]|_%(extended_[ab]|supplementary)|supplement%(ary)?| %(extended\-[ab]|supplement%(ary)?))?|priot%(syllabary|[ _]syllabary))|u%(rrency%([_ ]symbols|symbols)|neiform%(_numbers_and_punctuation|numbersandpunctuation| numbers and punctuation)?)|arian|h%(erokee|am)|jk%(s%(ymbolsandpunctuation|trokes)|compatibility%(forms|ideographs%(supplement)?)?|radicalssupplement| %(compatibility%( %(ideographs%( supplement)?|forms))?|radicals supplement|unified ideographs%( extension [dacb])?|s%(ymbols and punctuation|trokes))|_%(s%(trokes|ymbols_and_punctuation)|radicals_supplement|compatibility%(_%(forms|ideographs%(_supplement)?))?|unified_ideographs%(_extension_[dacb])?)|unifiedideographs%(extension[dacb])?))|t%(i%(betan|finagh)|elugu|a%(mil|i%(xuanjingsymbols|_%(le|xuan_jing_symbols|tham|viet)|le| %(xuan jing symbols|le|tham|viet)|tham|viet)|g%(alog|s|banwa))|ransport%( and map symbols|_and_map_symbols|andmapsymbols)|ha%(i|ana))|a%(l%(chemical%([_ ]symbols|symbols)|phabetic%( presentation forms|_presentation_forms|presentationforms))|ncient%(_%(greek_%(musical_notation|numbers)|symbols)|greek%(numbers|musicalnotation)| %(greek %(numbers|musical notation)|symbols)|symbols)|egean%(numbers|[ _]numbers)|vestan|r%(abic%( %(supplement|presentation forms\-[ab])|supplement|_%(presentation_forms_[ab]|supplement)|presentationforms\-[ab])?|menian|rows))|u%(garitic|nified%(canadianaboriginalsyllabics%(extended)?|_canadian_aboriginal_syllabics%(_extended)?| canadian aboriginal syllabics%( extended)?))|v%(a%(i|riation%( selectors%( supplement)?|selectors%(supplement)?|_selectors%(_supplement)?))|e%(rtical%(forms|[ _]forms)|dic%([ _]extensions|extensions))))\}" contained display - -syntax match clojureRegexpPredefinedCharClass "\v%(\\[dDsSwW]|\.)" contained display -syntax cluster clojureRegexpCharPropertyClasses contains=clojureRegexpPosixCharClass,clojureRegexpJavaCharClass,clojureRegexpUnicodeCharClass -syntax cluster clojureRegexpCharClasses contains=clojureRegexpPredefinedCharClass,clojureRegexpCharClass,@clojureRegexpCharPropertyClasses -syntax region clojureRegexpCharClass start="\[" skip=/\\\\\|\\]/ end="]" contained contains=clojureRegexpPredefinedCharClass,@clojureRegexpCharPropertyClasses -syntax match clojureRegexpBoundary "\\[bBAGZz]" contained display -syntax match clojureRegexpBoundary "[$^]" contained display -syntax match clojureRegexpQuantifier "[?*+][?+]\=" contained display -syntax match clojureRegexpQuantifier "\v\{\d+%(,|,\d+)?}\??" contained display -syntax match clojureRegexpOr "|" contained display -syntax match clojureRegexpBackRef "\v\\%([1-9]\d*|k\<[a-zA-z]+\>)" contained display +syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(Is|sc\=|script\=)%(l%(epc%(ha)?|y%([dc]i%(an)?)|a%(t%(n|in)|na|oo?)|i%(n%(b|ear_b)|mbu?|su))|p%(rti|lrd|h%(oenician|li|ag%(s_pa)?|nx))|vaii?|d%(srt|e%(seret|va%(nagari)?))|g%(lag%(olitic)?|eor%(gian)?|oth%(ic)?|re%(k|ek)|u%(j%(arati|r)|r%(u|mukhi)))|u%(gar%(itic)?|nknown)|a%(r%(ab%(ic)?|m%([ni]|enian))|v%(st|estan))|e%(thi%(opic)?|gyp%(tian_hieroglyphs)?)|z%(inh|yyy|zzz)|r%(un%(ic|r)|ejang|jng)|s%(inh%(ala)?|h%(rd|a%(vian|rada|w))|a%(ur%(ashtra)?|m%(r|aritan)|rb)|y%(r%(c|iac)|lo%(ti_nagri)?)|und%(anese)?|ora%(_sompeng)?)|i%(n%(scriptional_pa%(rthian|hlavi)|herited)|mperial_aramaic|tal)|b%(eng%(ali)?|a%(t%(ak|k)|li%(nese)?|mum?)|ra%(i%(lle)?|h%(mi)?)|opo%(mofo)?|u%(gi%(nese)?|h%(d|id)))|o%(g%(am|ham)|r%(iya|kh|ya)|sma%(nya)?|l%(d_%(south_arabian|persian|italic|turkic)|ck|_chiki))|k%(h%(m%(r|er)|ar%(oshthi)?)|nda|a%(li|n%(a|nada)|takana|yah_li|ithi)|thi)|m%(a%(nd%(aic)?|layalam)|lym|y%(anmar|mr)|tei|e%(r%(c|o%(itic_%(hieroglyphs|cursive))?)|etei_mayek)|ong%(olian)?|iao)|yi%(ii)?|x%(peo|sux)|n%(ew_tai_lue|koo?)|h%(ira%(gana)?|an%([io]|unoo|g%(ul)?)?|ebr%(ew)?)|c%(y%(priot|r%(l|illic))|a%(km|n%(adian_aboriginal|s)|ri%(an)?)|prt|h%(er%(okee)?|a%(m|kma))|uneiform|o%(pt%(ic)?|mmon))|t%(elu%(gu)?|i%(finagh|b%(t|etan))|ha%(i|a%(na)?)|a%(i_%(le|tham|viet)|g%(alog|b%(anwa)?)|vt|kri?|l[ue]|m%(il|l))|fng|glg)|java%(nese)?)\}" contained display +syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(In|blk\=|block\=)%(javanese|h%(a%(lfwidth%( and fullwidth forms|andfullwidthforms|_and_fullwidth_forms)|n%(unoo|gul%(compatibilityjamo|syllables|jamo%(extended\-[ab])?|_%(syllables|jamo%(_extended_[ab])?|compatibility_jamo)| %(syllables|compatibility jamo|jamo%( extended\-[ab])?))))|i%(ragana|gh%( %(private use surrogates|surrogates)|_%(private_use_surrogates|surrogates)|surrogates|privateusesurrogates))|ebrew)|i%(pa%([ _]extensions|extensions)|deographic%( description characters|_description_characters|descriptioncharacters)|nscriptional%(%([ _]pa%(rthian|hlavi))|pa%(rthian|hlavi))|mperial%(aramaic|[_ ]aramaic))|l%(e%(tterlike%([_ ]symbols|symbols)|pcha)|ow%([_ ]surrogates|surrogates)|i%(mbu|near%(_b_%(ideograms|syllabary)|b%(ideograms|syllabary)| b %(ideograms|syllabary))|su)|a%(tin%(extended%(additional|\-[dacb])| extended%( additional|\-[dacb])|\-1%(supplement| supplement)|_%(extended_%([dcb]|a%(dditional)?)|1_supplement))|o)|y[cd]ian)|b%(u%(ginese|hid)|ra%(hmi|ille%(patterns|[_ ]patterns))|o%(x%([ _]drawing|drawing)|pomofo%([ _]extended|extended)?)|lock%([ _]elements|elements)|yzantine%( musical symbols|musicalsymbols|_musical_symbols)|engali|a%(linese|mum%(supplement|[ _]supplement)?|tak|sic%([ _]latin|latin)))|e%(gyptian%([ _]hieroglyphs|hieroglyphs)|moticons|nclosed%( %(cjk letters and months|ideographic supplement|alphanumeric%( supplement|s))|cjklettersandmonths|_%(ideographic_supplement|alphanumeric%(_supplement|s)|cjk_letters_and_months)|alphanumerics%(upplement)?|ideographicsupplement)|thiopic%(supplement|_%(supplement|extended%(_a)?)| %(supplement|extended%(\-a)?)|extended%(\-a)?)?)|k%(h%(aroshthi|mer%([_ ]symbols|symbols)?)|a%(takana%(_phonetic_extensions|phoneticextensions| phonetic extensions)?|n%(gxi%([_ ]radicals|radicals)|a%(supplement|[ _]supplement)|bun|nada)|ithi|yah%([ _]li|li)))|m%(i%(ao|scellaneous%(technical|symbols%(and%(pictographs|arrows))?|mathematicalsymbols\-[ab]| %(technical|mathematical symbols\-[ab]|symbols%( and %(pictographs|arrows))?)|_%(technical|symbols%(_and_%(pictographs|arrows))?|mathematical_symbols_[ab])))|usical%([_ ]symbols|symbols)|e%(etei%(mayek%(extensions)?|_mayek%(_extensions)?| mayek%( extensions)?)|roitic%(hieroglyphs|%([_ ]%(hieroglyphs|cursive))|cursive))|a%(ndaic|hjong%([ _]tiles|tiles)|layalam|thematical%(alphanumericsymbols| %(alphanumeric symbols|operators)|_%(alphanumeric_symbols|operators)|operators))|yanmar%(extended\-a|_extended_a| extended\-a)?|o%(difier%(_tone_letters| tone letters|toneletters)|ngolian))|r%(u%(nic|mi%(numeralsymbols| numeral symbols|_numeral_symbols))|ejang)|n%(umber%(forms|[ _]forms)|ko|ew%(_tai_lue|tailue| tai lue))|c%(o%(ntrol%(pictures|[ _]pictures)|m%(bining%(diacriticalmarks%(supplement|forsymbols)?|halfmarks| %(diacritical marks%( %(supplement|for symbols))?|half marks|marks for symbols)|marksforsymbols|_%(marks_for_symbols|half_marks|diacritical_marks%(_supplement)?))|mon%(_indic_number_forms|indicnumberforms| indic number forms))|ptic|unting%( rod numerals|_rod_numerals|rodnumerals))|y%(rillic%(extended\-[ab]|_%(extended_[ab]|supplementary)|supplement%(ary)?| %(extended\-[ab]|supplement%(ary)?))?|priot%(syllabary|[ _]syllabary))|u%(rrency%([_ ]symbols|symbols)|neiform%(_numbers_and_punctuation|numbersandpunctuation| numbers and punctuation)?)|h%(a%(m|kma)|erokee)|arian|jk%(s%(ymbolsandpunctuation|trokes)|compatibility%(forms|ideographs%(supplement)?)?|radicalssupplement| %(compatibility%( %(ideographs%( supplement)?|forms))?|radicals supplement|unified ideographs%( extension [dacb])?|s%(ymbols and punctuation|trokes))|_%(s%(trokes|ymbols_and_punctuation)|radicals_supplement|compatibility%(_%(forms|ideographs%(_supplement)?))?|unified_ideographs%(_extension_[dacb])?)|unifiedideographs%(extension[dacb])?))|d%(e%(seret|vanagari%([ _]extended|extended)?)|ingbats|omino%([ _]tiles|tiles))|yi%(syllables|%([_ ]%(syllables|radicals))|radicals|jing%(hexagramsymbols| hexagram symbols|_hexagram_symbols))|s%(mall%( form variants|formvariants|_form_variants)|p%(acing%(_modifier_letters| modifier letters|modifierletters)|ecials)|ora%(sompeng|[ _]sompeng)|ha%(vian|rada)|a%(maritan|urashtra)|inhala|y%(riac|loti%([_ ]nagri|nagri))|u%(ndanese%(supplement|[ _]supplement)?|p%(erscripts%(_and_subscripts|andsubscripts| and subscripts)|plementa%(ry%(_private_use_area_[ab]|privateusearea\-[ab]| private use area\-[ab])|l%(_%(arrows_[ab]|mathematical_operators|punctuation)| %(mathematical operators|punctuation|arrows\-[ab])|mathematicaloperators|punctuation|arrows\-[ab])))|rrogates_area))|p%(h%(o%(enician|netic%( extensions%( supplement)?|extensions%(supplement)?|_extensions%(_supplement)?))|a%(istos%([ _]disc|disc)|gs[_\-]pa))|laying%(cards|[_ ]cards)|rivate%(usearea| use area|_use_area))|o%(smanya|l%([ _]chiki|d%( %(south arabian|persian|italic|turkic)|southarabian|_%(south_arabian|persian|italic|turkic)|persian|italic|turkic)|chiki)|riya|ptical%( character recognition|_character_recognition|characterrecognition)|gham)|g%(u%(jarati|rmukhi)|othic|lagolitic|e%(o%(rgian%(supplement|[ _]supplement)?|metric%(shapes|[ _]shapes))|neral%([_ ]punctuation|punctuation))|reek%( %(and coptic|extended)|andcoptic|_extended|extended)?)|t%(i%(betan|finagh)|elugu|ransport%( and map symbols|_and_map_symbols|andmapsymbols)|a%(mil|kri|i%(xuanjingsymbols|_%(le|xuan_jing_symbols|tham|viet)|le| %(xuan jing symbols|le|tham|viet)|tham|viet)|g%(alog|s|banwa))|ha%(i|ana))|a%(l%(chemical%([_ ]symbols|symbols)|phabetic%( presentation forms|_presentation_forms|presentationforms))|r%(menian|abic%(extended\-a|mathematicalalphabeticsymbols|supplement|_%(presentation_forms_[ab]|supplement|extended_a|mathematical_alphabetic_symbols)| %(extended\-a|mathematical alphabetic symbols|supplement|presentation forms\-[ab])|presentationforms\-[ab])?|rows)|ncient%(_%(greek_%(musical_notation|numbers)|symbols)|greek%(numbers|musicalnotation)| %(greek %(numbers|musical notation)|symbols)|symbols)|egean%(numbers|[ _]numbers)|vestan)|u%(garitic|nified%(canadianaboriginalsyllabics%(extended)?|_canadian_aboriginal_syllabics%(_extended)?| canadian aboriginal syllabics%( extended)?))|v%(a%(i|riation%( selectors%( supplement)?|selectors%(supplement)?|_selectors%(_supplement)?))|e%(rtical%(forms|[ _]forms)|dic%([ _]extensions|extensions))))\}" contained display + +syntax match clojureRegexpPredefinedCharClass "\v%(\\[dDsSwW]|\.)" contained display +syntax cluster clojureRegexpCharPropertyClasses contains=clojureRegexpPosixCharClass,clojureRegexpJavaCharClass,clojureRegexpUnicodeCharClass +syntax cluster clojureRegexpCharClasses contains=clojureRegexpPredefinedCharClass,clojureRegexpCharClass,@clojureRegexpCharPropertyClasses +syntax region clojureRegexpCharClass start="\[" skip=/\\\\\|\\]/ end="]" contained contains=clojureRegexpPredefinedCharClass,@clojureRegexpCharPropertyClasses +syntax match clojureRegexpBoundary "\\[bBAGZz]" contained display +syntax match clojureRegexpBoundary "[$^]" contained display +syntax match clojureRegexpQuantifier "[?*+][?+]\=" contained display +syntax match clojureRegexpQuantifier "\v\{\d+%(,|,\d+)?}\??" contained display +syntax match clojureRegexpOr "|" contained display +syntax match clojureRegexpBackRef "\v\\%([1-9]\d*|k\<[a-zA-z]+\>)" contained display " Mode modifiers, mode-modified spans, lookaround, regular and atomic " grouping, and named-capturing. @@ -123,66 +154,70 @@ syntax match clojureComment ";.*$" contains=clojureCommentTodo,@Spell syntax match clojureComment "#!.*$" " -*- TOP CLUSTER -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj syntax cluster clojureTop contains=@Spell,clojureAnonArg,clojureBoolean,clojureCharacter,clojureComment,clojureCond,clojureConstant,clojureDefine,clojureDeref,clojureDispatch,clojureError,clojureException,clojureFunc,clojureKeyword,clojureMacro,clojureMap,clojureMeta,clojureNumber,clojureQuote,clojureRegexp,clojureRepeat,clojureSexp,clojureSpecial,clojureString,clojureSymbol,clojureUnquote,clojureVarArg,clojureVariable,clojureVector -syntax region clojureSexp matchgroup=clojureParen start="(" matchgroup=clojureParen end=")" contains=@clojureTop fold -syntax region clojureVector matchgroup=clojureParen start="\[" matchgroup=clojureParen end="]" contains=@clojureTop fold -syntax region clojureMap matchgroup=clojureParen start="{" matchgroup=clojureParen end="}" contains=@clojureTop fold +syntax region clojureSexp matchgroup=clojureParen start="(" end=")" contains=@clojureTop fold +syntax region clojureVector matchgroup=clojureParen start="\[" end="]" contains=@clojureTop fold +syntax region clojureMap matchgroup=clojureParen start="{" end="}" contains=@clojureTop fold " Highlight superfluous closing parens, brackets and braces. syntax match clojureError "]\|}\|)" syntax sync fromstart -highlight default link clojureConstant Constant -highlight default link clojureBoolean Boolean -highlight default link clojureCharacter Character -highlight default link clojureKeyword Keyword -highlight default link clojureNumber Number -highlight default link clojureString String -highlight default link clojureStringEscape Character - -highlight default link clojureRegexp Constant -highlight default link clojureRegexpEscape Character -highlight default link clojureRegexpCharClass SpecialChar -highlight default link clojureRegexpPosixCharClass clojureRegexpCharClass -highlight default link clojureRegexpJavaCharClass clojureRegexpCharClass -highlight default link clojureRegexpUnicodeCharClass clojureRegexpCharClass -highlight default link clojureRegexpPredefinedCharClass clojureRegexpCharClass -highlight default link clojureRegexpBoundary SpecialChar -highlight default link clojureRegexpQuantifier SpecialChar -highlight default link clojureRegexpMod SpecialChar -highlight default link clojureRegexpOr SpecialChar -highlight default link clojureRegexpBackRef SpecialChar -highlight default link clojureRegexpGroup clojureRegexp -highlight default link clojureRegexpQuoted clojureString -highlight default link clojureRegexpQuote clojureRegexpBoundary - -highlight default link clojureVariable Identifier -highlight default link clojureCond Conditional -highlight default link clojureDefine Define -highlight default link clojureException Exception -highlight default link clojureFunc Function -highlight default link clojureMacro Macro -highlight default link clojureRepeat Repeat - -highlight default link clojureSpecial Special -highlight default link clojureVarArg Special -highlight default link clojureQuote SpecialChar -highlight default link clojureUnquote SpecialChar -highlight default link clojureMeta SpecialChar -highlight default link clojureDeref SpecialChar -highlight default link clojureAnonArg SpecialChar -highlight default link clojureDispatch SpecialChar - -highlight default link clojureComment Comment -highlight default link clojureCommentTodo Todo - -highlight default link clojureError Error - -highlight default link clojureParen Delimiter +highlight default link clojureConstant Constant +highlight default link clojureBoolean Boolean +highlight default link clojureCharacter Character +highlight default link clojureKeyword Keyword +highlight default link clojureNumber Number +highlight default link clojureString String +highlight default link clojureStringDelimiter String +highlight default link clojureStringEscape Character + +highlight default link clojureRegexp Constant +highlight default link clojureRegexpEscape Character +highlight default link clojureRegexpCharClass SpecialChar +highlight default link clojureRegexpPosixCharClass clojureRegexpCharClass +highlight default link clojureRegexpJavaCharClass clojureRegexpCharClass +highlight default link clojureRegexpUnicodeCharClass clojureRegexpCharClass +highlight default link clojureRegexpPredefinedCharClass clojureRegexpCharClass +highlight default link clojureRegexpBoundary SpecialChar +highlight default link clojureRegexpQuantifier SpecialChar +highlight default link clojureRegexpMod SpecialChar +highlight default link clojureRegexpOr SpecialChar +highlight default link clojureRegexpBackRef SpecialChar +highlight default link clojureRegexpGroup clojureRegexp +highlight default link clojureRegexpQuoted clojureString +highlight default link clojureRegexpQuote clojureRegexpBoundary + +highlight default link clojureVariable Identifier +highlight default link clojureCond Conditional +highlight default link clojureDefine Define +highlight default link clojureException Exception +highlight default link clojureFunc Function +highlight default link clojureMacro Macro +highlight default link clojureRepeat Repeat + +highlight default link clojureSpecial Special +highlight default link clojureVarArg Special +highlight default link clojureQuote SpecialChar +highlight default link clojureUnquote SpecialChar +highlight default link clojureMeta SpecialChar +highlight default link clojureDeref SpecialChar +highlight default link clojureAnonArg SpecialChar +highlight default link clojureDispatch SpecialChar + +highlight default link clojureComment Comment +highlight default link clojureCommentTodo Todo + +highlight default link clojureError Error + +highlight default link clojureParen Delimiter let b:current_syntax = "clojure" -" vim:sts=8:sw=8:ts=8:noet:smc=0 +let &cpo = s:cpo_sav +unlet! s:cpo_sav + +" vim:sts=8:sw=8:ts=8:noet diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index c7a68388be..fefd0ff7b0 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -2,7 +2,7 @@ " Language: C++ " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> -" Last Change: 2015 Nov 10 +" Last Change: 2016 Jul 07 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -80,6 +80,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits") HiLink cppConstant Constant HiLink cppRawStringDelimiter Delimiter HiLink cppRawString String + HiLink cppNumber Number delcommand HiLink endif diff --git a/runtime/syntax/d.vim b/runtime/syntax/d.vim index 07a299fa55..8be9b9ff28 100644 --- a/runtime/syntax/d.vim +++ b/runtime/syntax/d.vim @@ -1,9 +1,9 @@ -" Vim syntax file for the D programming language (version 1.076 and 2.063). +" Vim syntax file for the D programming language (version 1.076 and 2.069). " " Language: D " Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com> -" Last Change: 2013 October 5 -" Version: 0.26 +" Last Change: 2016 Feb 2 +" Version: 0.28 " " Contributors: " - Jason Mills: original Maintainer @@ -15,6 +15,7 @@ " - Steven N. Oliver " - Sohgo Takeuchi " - Robert Clipsham +" - Petar Kirov " " Please submit bugs/comments/suggestions to the github repo: " https://github.com/JesseKPhillips/d.vim @@ -114,17 +115,19 @@ syn keyword dTraitsIdentifier contained isIntegral isScalar isStaticArray syn keyword dTraitsIdentifier contained isUnsigned isVirtualFunction syn keyword dTraitsIdentifier contained isVirtualMethod isAbstractFunction syn keyword dTraitsIdentifier contained isFinalFunction isStaticFunction +syn keyword dTraitsIdentifier contained isOverrideFunction isTemplate syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember -syn keyword dTraitsIdentifier contained identifier getAttributes getMember -syn keyword dTraitsIdentifier contained getOverloads getProtection -syn keyword dTraitsIdentifier contained getVirtualFunctions -syn keyword dTraitsIdentifier contained getVirtualMethods parent -syn keyword dTraitsIdentifier contained classInstanceSize allMembers +syn keyword dTraitsIdentifier contained identifier getAliasThis +syn keyword dTraitsIdentifier contained getAttributes getFunctionAttributes getMember +syn keyword dTraitsIdentifier contained getOverloads getPointerBitmap getProtection +syn keyword dTraitsIdentifier contained getVirtualFunctions getVirtualIndex +syn keyword dTraitsIdentifier contained getVirtualMethods getUnitTests +syn keyword dTraitsIdentifier contained parent classInstanceSize allMembers syn keyword dTraitsIdentifier contained derivedMembers isSame compiles -syn keyword dPragmaIdentifier contained lib msg startaddress GNU_asm -syn keyword dExternIdentifier contained Windows Pascal Java System D +syn keyword dPragmaIdentifier contained inline lib mangle msg startaddress GNU_asm +syn keyword dExternIdentifier contained C C++ D Windows Pascal System Objective-C syn keyword dAttribute contained safe trusted system -syn keyword dAttribute contained property disable +syn keyword dAttribute contained property disable nogc syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64 @@ -134,7 +137,7 @@ syn keyword dVersionIdentifier contained Cygwin MinGW syn keyword dVersionIdentifier contained LittleEndian BigEndian syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64 syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC -syn keyword dVersionIdentifier contained unittest none all +syn keyword dVersionIdentifier contained unittest assert none all syn cluster dComment contains=dNestedComment,dBlockComment,dLineComment @@ -168,10 +171,10 @@ syn match dExternal "\<extern\>" syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier " Make import a region to prevent highlighting keywords -syn region dImport start="import\_s" end=";" contains=dExternal,@dComment +syn region dImport start="\<import\_s" end=";" contains=dExternal,@dComment " Make module a region to prevent highlighting keywords -syn region dImport start="module\_s" end=";" contains=dExternal,@dComment +syn region dImport start="\<module\_s" end=";" contains=dExternal,@dComment " dTokens is used by the token string highlighting syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean @@ -246,13 +249,17 @@ syn match dUnicode "\\u\d\{4\}" " String. " -syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dEscSequence,@Spell +syn match dFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained +syn match dFormat display "%%" contained + +syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dFormat,dEscSequence,@Spell syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell syn region dHereString start=+q"\z(\I\i*\)\n+ end=+^\z1"+ contains=@Spell + " Nesting delimited string contents " syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell @@ -276,8 +283,8 @@ syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString " Token strings " -syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens -syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens +syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens,dFormat +syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens,dFormat syn cluster dTokens add=dTokenString @@ -357,6 +364,7 @@ hi def link dString String hi def link dHexString String hi def link dCharacter Character hi def link dEscSequence SpecialChar +hi def link dFormat SpecialChar hi def link dSpecialCharError Error hi def link dOctalError Error hi def link dOperator Operator diff --git a/runtime/syntax/dcl.vim b/runtime/syntax/dcl.vim index 37bf38fe11..73bf577e3e 100644 --- a/runtime/syntax/dcl.vim +++ b/runtime/syntax/dcl.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: DCL (Digital Command Language - vms) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Oct 23, 2014 -" Version: 7 +" Last Change: May 02, 2016 +" Version: 9 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL " For version 5.x: Clear all syntax items @@ -13,10 +13,10 @@ elseif exists("b:current_syntax") finish endif -if version < 600 - set iskeyword=$,@,48-57,_ -else +if !has("patch-7.4.1142") setlocal iskeyword=$,@,48-57,_ +else + syn iskeyword $,@,48-57,_ endif syn case ignore diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 4f1d6d4b11..d0c658c75e 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2015 Oct 24 +" Last Change: 2016 Apr 24 " URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim " Standard syntax initialization @@ -23,7 +23,7 @@ let binNMU='binary-only=yes' syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " exe 'syn match debchangelogFirstKV contained "; \('.urgency.'\|'.binNMU.'\)"' exe 'syn match debchangelogOtherKV contained ", \('.urgency.'\|'.binNMU.'\)"' -syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial|yakkety)%(-%(security|proposed|updates|backports|commercial|partner))=)+" syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index e0c5f4075f..d35e24729d 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl> -" Last Change: 2015 Oct 24 +" Last Change: 2016 Apr 24 " URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim " Standard syntax initialization @@ -27,7 +27,7 @@ let s:supported = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', \ 'squeeze', 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy', \ - \ 'precise', 'trusty', 'vivid', 'wily', 'xenial', 'devel' + \ 'precise', 'trusty', 'wily', 'xenial', 'yakkety', 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', @@ -36,7 +36,7 @@ let s:unsupported = [ \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'quantal', 'raring', 'saucy', - \ 'utopic' + \ 'utopic', 'vivid' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/desktop.vim b/runtime/syntax/desktop.vim index 5b71e51192..27dac5c8ee 100644 --- a/runtime/syntax/desktop.vim +++ b/runtime/syntax/desktop.vim @@ -3,7 +3,8 @@ " according to freedesktop.org specification 0.9.4 " http://pdx.freedesktop.org/Standards/desktop-entry-spec/desktop-entry-spec-0.9.4.html " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2004 May 16 +" Last Change: 2016 Apr 02 +" (added "Keywords") " Version Info: desktop.vim 0.9.4-1.2 " For version 5.x: Clear all syntax items @@ -53,8 +54,8 @@ syn keyword dtBooleanKey StartupNotify ReadOnly Terminal Hidden NoDisplay nextgr syn keyword dtBooleanValue true false containedin=dtBoolean contained " String -syn match dtString /^\s*\<\(Encoding\|Icon\|Path\|Actions\|FSType\|MountPoint\|UnmountIcon\|URL\|Categories\|OnlyShowIn\|NotShowIn\|StartupWMClass\|FilePattern\|MimeType\)\>.*/ contains=dtStringKey,dtDelim transparent -syn keyword dtStringKey Type Encoding TryExec Exec Path Actions FSType MountPoint URL Categories OnlyShowIn NotShowIn StartupWMClass FilePattern MimeType nextgroup=dtDelim containedin=dtString contained +syn match dtString /^\s*\<\(Encoding\|Icon\|Path\|Actions\|FSType\|MountPoint\|UnmountIcon\|URL\|Keywords\|Categories\|OnlyShowIn\|NotShowIn\|StartupWMClass\|FilePattern\|MimeType\)\>.*/ contains=dtStringKey,dtDelim transparent +syn keyword dtStringKey Type Encoding TryExec Exec Path Actions FSType MountPoint URL Keywords Categories OnlyShowIn NotShowIn StartupWMClass FilePattern MimeType nextgroup=dtDelim containedin=dtString contained " Exec syn match dtExec /^\s*\<\(Exec\|TryExec\|SwallowExec\)\>.*/ contains=dtExecKey,dtDelim,dtExecParam transparent diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim index 885feaebdd..b656cd97a6 100644 --- a/runtime/syntax/diff.vim +++ b/runtime/syntax/diff.vim @@ -2,7 +2,7 @@ " Language: Diff (context or unified) " Maintainer: Bram Moolenaar <Bram@vim.org> " Translations by Jakson Alves de Aquino. -" Last Change: 2015 Feb 03 +" Last Change: 2016 Apr 02 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -342,7 +342,7 @@ syn match diffLine "^\<\d\+\>.*" syn match diffLine "^\*\*\*\*.*" syn match diffLine "^---$" -"Some versions of diff have lines like "#c#" and "#d#" (where # is a number) +" Some versions of diff have lines like "#c#" and "#d#" (where # is a number) syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*" syn match diffFile "^diff\>.*" @@ -352,12 +352,16 @@ syn match diffFile "^==== .*" syn match diffOldFile "^\*\*\* .*" syn match diffNewFile "^--- .*" +" Used by git +syn match diffIndexLine "^index \x\x\x\x.*" + syn match diffComment "^#.*" " Define the default highlighting. " Only used when an item doesn't have highlighting yet hi def link diffOldFile diffFile hi def link diffNewFile diffFile +hi def link diffIndexLine PreProc hi def link diffFile Type hi def link diffOnly Constant hi def link diffIdentical Constant diff --git a/runtime/syntax/dockerfile.vim b/runtime/syntax/dockerfile.vim index d1693cba41..15b66925e5 100644 --- a/runtime/syntax/dockerfile.vim +++ b/runtime/syntax/dockerfile.vim @@ -1,7 +1,7 @@ " dockerfile.vim - Syntax highlighting for Dockerfiles -" Maintainer: Honza Pokorny <http://honza.ca> -" Version: 0.5 -" Last Change: 2014 Aug 29 +" Maintainer: Honza Pokorny <https://honza.ca> +" Version: 0.6 +" Last Change: 2016 Aug 9 " License: BSD @@ -13,7 +13,7 @@ let b:current_syntax = "dockerfile" syntax case ignore -syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|CMD|ENTRYPOINT|ENV|EXPOSE|FROM|MAINTAINER|RUN|USER|VOLUME|WORKDIR|COPY)\s/ +syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)\s/ syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/ diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index 26d063524e..b470e56f60 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,15 +1,16 @@ " Vim syntax file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) -" Version: 0.96 -" Last Change: 2015 Nov. 30 +" Version: 0.97 +" Last Change: 2016 Feb. 26 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> " Usage: For instructions, do :help fortran-syntax from Vim " Credits: -" Version 0.1 was based on the fortran 77 syntax file by Mario Eusebio and -" Preben Guldberg. Useful suggestions and contributions were made by: Andrej Panjkov, -" Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, +" Version 0.1 (April 2000) was based on the fortran 77 syntax file by Mario Eusebio and +" Preben Guldberg. Since then, useful suggestions and contributions have been made, +" in chronological order, by: +" Andrej Panjkov, Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, " Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman, -" Andrew Griffiths, Joe Krahn, Hendrik Merx, and Matt Thompson. +" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, and Jan Hermann. if exists("b:current_syntax") finish @@ -407,7 +408,7 @@ if exists("fortran_fold") else syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\s*[!#].*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData - syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData + syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(\(.\|&\s*\n\)\+)\(\s\|&\s*\n\)*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData syn region fortranCase transparent fold keepend extend start="\<select\s*case\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData endif endif diff --git a/runtime/syntax/groovy.vim b/runtime/syntax/groovy.vim index 42fcf4abac..dc39677724 100644 --- a/runtime/syntax/groovy.vim +++ b/runtime/syntax/groovy.vim @@ -2,9 +2,9 @@ " Language: Groovy " Original Author: Alessio Pace <billy.corgan@tiscali.it> " Maintainer: Tobias Rapp <yahuxo@gmx.de> -" Version: 0.1.14 +" Version: 0.1.16 " URL: http://www.vim.org/scripts/script.php?script_id=945 -" Last Change: 2015 Apr 21 +" Last Change: 2016 May 23 " THE ORIGINAL AUTHOR'S NOTES: " @@ -255,8 +255,11 @@ syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpeci syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell syn region groovyString start=+"""+ end=+"""+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr syn region groovyString start=+'''+ end=+'''+ contains=groovySpecialChar,groovySpecialError,@Spell -" regex string -syn region groovyString start='/[^/]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr +if exists("groovy_regex_strings") + " regex strings interfere with the division operator and thus are disabled + " by default + syn region groovyString start='/[^/*]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr +endif " syn region groovyELExpr start=+${+ end=+}+ keepend contained syn match groovyELExpr /\${.\{-}}/ contained syn match groovyELExpr /\$[a-zA-Z_][a-zA-Z0-9_.]*/ contained diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim index d133c6a804..41bb0b1938 100644 --- a/runtime/syntax/help.vim +++ b/runtime/syntax/help.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Vim help file " Maintainer: Bram Moolenaar (Bram@vim.org) -" Last Change: 2014 Feb 12 +" Last Change: 2016 Apr 01 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -41,6 +41,7 @@ syn match helpVim "NVIM REFERENCE.*" syn match helpOption "'[a-z]\{2,\}'" syn match helpOption "'t_..'" syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick +syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore if has("conceal") @@ -58,7 +59,7 @@ syn match helpSpecial "\[N]" syn match helpSpecial "N N"he=s+1 syn match helpSpecial "Nth"me=e-2 syn match helpSpecial "N-1"me=e-2 -syn match helpSpecial "{[-a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}" +syn match helpSpecial "{[-_a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}" syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1 syn match helpSpecial "<[-a-zA-Z0-9_]\+>" syn match helpSpecial "<[SCM]-.>" diff --git a/runtime/syntax/lisp.vim b/runtime/syntax/lisp.vim index 2528f4f9b1..a402452389 100644 --- a/runtime/syntax/lisp.vim +++ b/runtime/syntax/lisp.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Lisp " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Oct 06, 2014 -" Version: 23 +" Last Change: May 02, 2016 +" Version: 25 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP " " Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec @@ -16,8 +16,10 @@ endif if exists("g:lisp_isk") exe "setl isk=".g:lisp_isk -else +elseif !has("patch-7.4.1142") setl isk=38,42,43,45,47-58,60-62,64-90,97-122,_ +else + syn iskeyword 38,42,43,45,47-58,60-62,64-90,97-122,_ endif if exists("g:lispsyntax_ignorecase") || exists("g:lispsyntax_clisp") diff --git a/runtime/syntax/man.vim b/runtime/syntax/man.vim index fbc1847e6e..819b2adc31 100644 --- a/runtime/syntax/man.vim +++ b/runtime/syntax/man.vim @@ -1,67 +1,40 @@ -" Vim syntax file -" Language: Man page -" Maintainer: SungHyun Nam <goweol@gmail.com> -" Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com> -" Version Info: -" Last Change: 2015 Nov 24 +" Maintainer: Anmol Sethi <anmol@aubble.com> +" Previous Maintainer: SungHyun Nam <goweol@gmail.com> -" Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>: -" * manSubHeading -" * manSynopsis (only for sections 2 and 3) - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists('b:current_syntax') finish endif -" Get the CTRL-H syntax to handle backspaced text -if version >= 600 - runtime! syntax/ctrlh.vim -else - source <sfile>:p:h/ctrlh.vim -endif - -syn case ignore -syn match manReference "\f\+([1-9][a-z]\=)" -syn match manTitle "^\f\+([0-9]\+[a-z]\=).*" -syn match manSectionHeading "^[a-z][a-z -]*[a-z]$" -syn match manSubHeading "^\s\{3\}[a-z][a-z -]*[a-z]$" -syn match manOptionDesc "^\s*[+-][a-z0-9]\S*" -syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*" -" syn match manHistory "^[a-z].*last change.*$" - -if getline(1) =~ '^[a-zA-Z_]\+([23])' - syntax include @cCode <sfile>:p:h/c.vim - syn match manCFuncDefinition display "\<\h\w*\>\s*("me=e-1 contained - syn region manSynopsis start="^SYNOPSIS"hs=s+8 end="^\u\+\s*$"me=e-12 keepend contains=manSectionHeading,@cCode,manCFuncDefinition +syntax case ignore +syntax match manReference display '[^()[:space:]]\+([0-9nx][a-z]*)' +syntax match manSectionHeading display '^\S.*$' +syntax match manTitle display '^\%1l.*$' +syntax match manSubHeading display '^ \{3\}\S.*$' +syntax match manOptionDesc display '^\s\+\%(+\|-\)\S\+' + +highlight default link manTitle Title +highlight default link manSectionHeading Statement +highlight default link manOptionDesc Constant +highlight default link manReference PreProc +highlight default link manSubHeading Function + +if !exists('b:man_sect') + call man#init_pager() endif - - -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_man_syn_inits") - if version < 508 - let did_man_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink manTitle Title - HiLink manSectionHeading Statement - HiLink manOptionDesc Constant - HiLink manLongOptionDesc Constant - HiLink manReference PreProc - HiLink manSubHeading Function - HiLink manCFuncDefinition Function - - delcommand HiLink +if b:man_sect =~# '^[23]' + syntax include @c $VIMRUNTIME/syntax/c.vim + syntax match manCFuncDefinition display '\<\h\w*\>\ze\(\s\|\n\)*(' contained + syntax region manSynopsis start='^\%( + \SYNOPSIS\| + \SYNTAX\| + \SINTASSI\| + \SKÅADNIA\| + \СИÐТÐКСИС\| + \書å¼\)$' end='^\%(\S.*\)\=\S$' keepend contains=manSectionHeading,@c,manCFuncDefinition + highlight default link manCFuncDefinition Function endif -let b:current_syntax = "man" +" Prevent everything else from matching the last line +execute 'syntax match manFooter display "^\%'.line('$').'l.*$"' -" vim:ts=8 sts=2 sw=2: +let b:current_syntax = 'man' diff --git a/runtime/syntax/maple.vim b/runtime/syntax/maple.vim index 9c94643836..77b1507b36 100644 --- a/runtime/syntax/maple.vim +++ b/runtime/syntax/maple.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Maple V (based on release 4) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Oct 23, 2014 -" Version: 11 +" Last Change: May 02, 2016 +" Version: 13 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE " " Package Function Selection: {{{1 @@ -30,10 +30,10 @@ elseif exists("b:current_syntax") endif " Iskeyword Effects: {{{1 -if version < 600 - set iskeyword=$,48-57,_,a-z,@-Z +if !has("patch-7.4.1142") + setl isk=$,48-57,_,a-z,@-Z else - setlocal iskeyword=$,48-57,_,a-z,@-Z + syn iskeyword $,48-57,_,a-z,@-Z endif " Package Selection: {{{1 diff --git a/runtime/syntax/messages.vim b/runtime/syntax/messages.vim index 4648e94c13..c22e4e8d0c 100644 --- a/runtime/syntax/messages.vim +++ b/runtime/syntax/messages.vim @@ -3,6 +3,7 @@ " Maintainer: Yakov Lerner <iler.ml@gmail.com> " Latest Revision: 2008-06-29 " Changes: 2008-06-29 support for RFC3339 tuimestamps James Vega +" 2016 Jan 19: messagesDate changed by Bram if exists("b:current_syntax") finish @@ -13,7 +14,7 @@ set cpo&vim syn match messagesBegin display '^' nextgroup=messagesDate,messagesDateRFC3339 -syn match messagesDate contained display '\a\a\a [ 0-9]\d *' +syn match messagesDate contained display '[[:lower:][:upper:]][[:lower:][:upper:]][[:lower:][:upper:]] [ 0-9]\d *' \ nextgroup=messagesHour syn match messagesHour contained display '\d\d:\d\d:\d\d\s*' diff --git a/runtime/syntax/mysql.vim b/runtime/syntax/mysql.vim index c01ecc192b..d7cf74710d 100644 --- a/runtime/syntax/mysql.vim +++ b/runtime/syntax/mysql.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: mysql " Maintainer: Kenneth J. Pronovici <pronovic@ieee.org> -" Last Change: $LastChangedDate: 2010-04-22 09:48:02 -0500 (Thu, 22 Apr 2010) $ +" Last Change: $LastChangedDate: 2016-04-11 10:31:04 -0500 (Mon, 11 Apr 2016) $ " Filenames: *.mysql " URL: ftp://cedar-solutions.com/software/mysql.vim " Note: The definitions below are taken from the mysql user manual as of April 2002, for version 3.23 @@ -18,7 +18,7 @@ endif syn case ignore " General keywords which don't fall into other categories -syn keyword mysqlKeyword action add after aggregate all alter as asc auto_increment avg avg_row_length +syn keyword mysqlKeyword action add after aggregate all alter as asc auto_increment avg_row_length syn keyword mysqlKeyword both by syn keyword mysqlKeyword cascade change character check checksum column columns comment constraint create cross syn keyword mysqlKeyword current_date current_time current_timestamp @@ -30,7 +30,7 @@ syn keyword mysqlKeyword global grant grants group syn keyword mysqlKeyword having heap high_priority hosts hour hour_minute hour_second syn keyword mysqlKeyword identified ignore index infile inner insert insert_id into isam syn keyword mysqlKeyword join -syn keyword mysqlKeyword key keys kill last_insert_id leading left limit lines load local lock logs long +syn keyword mysqlKeyword key keys kill last_insert_id leading left limit lines load local lock logs long syn keyword mysqlKeyword low_priority syn keyword mysqlKeyword match max_rows middleint min_rows minute minute_second modify month myisam syn keyword mysqlKeyword natural no @@ -64,6 +64,9 @@ syn match mysqlNumber "\<0x[abcdefABCDEF0-9]*\>" " User variables syn match mysqlVariable "@\a*[A-Za-z0-9]*\([._]*[A-Za-z0-9]\)*" +" Escaped column names +syn match mysqlEscaped "`[^`]*`" + " Comments (c-style, mysql-style and modified sql-style) syn region mysqlComment start="/\*" end="\*/" syn match mysqlComment "#.*" @@ -84,14 +87,14 @@ syn sync ccomment mysqlComment " The second problem is that some of these keywords are included in " function names. For instance, year() is part of the name of the " dayofyear() function, and the dec keyword (no parenthesis) is part of -" the name of the decode() function. +" the name of the decode() function. -syn keyword mysqlType tinyint smallint mediumint int integer bigint -syn keyword mysqlType date datetime time bit bool +syn keyword mysqlType tinyint smallint mediumint int integer bigint +syn keyword mysqlType date datetime time bit bool syn keyword mysqlType tinytext mediumtext longtext text syn keyword mysqlType tinyblob mediumblob longblob blob -syn region mysqlType start="float\W" end="."me=s-1 -syn region mysqlType start="float$" end="."me=s-1 +syn region mysqlType start="float\W" end="."me=s-1 +syn region mysqlType start="float$" end="."me=s-1 syn region mysqlType start="float(" end=")" contains=mysqlNumber,mysqlVariable syn region mysqlType start="double\W" end="."me=s-1 syn region mysqlType start="double$" end="."me=s-1 @@ -139,12 +142,12 @@ syn region mysqlFlow start="if(" end=")" contains=ALL " " I'm leery of just defining keywords for functions, since according to the MySQL manual: " -" Function names do not clash with table or column names. For example, ABS is a -" valid column name. The only restriction is that for a function call, no spaces -" are allowed between the function name and the `(' that follows it. +" Function names do not clash with table or column names. For example, ABS is a +" valid column name. The only restriction is that for a function call, no spaces +" are allowed between the function name and the `(' that follows it. " -" This means that if I want to highlight function names properly, I have to use a -" region to define them, not just a keyword. This will probably cause the syntax file +" This means that if I want to highlight function names properly, I have to use a +" region to define them, not just a keyword. This will probably cause the syntax file " to load more slowly, but at least it will be 'correct'. syn region mysqlFunction start="abs(" end=")" contains=ALL @@ -154,6 +157,7 @@ syn region mysqlFunction start="ascii(" end=")" contains=ALL syn region mysqlFunction start="asin(" end=")" contains=ALL syn region mysqlFunction start="atan(" end=")" contains=ALL syn region mysqlFunction start="atan2(" end=")" contains=ALL +syn region mysqlFunction start="avg(" end=")" contains=ALL syn region mysqlFunction start="benchmark(" end=")" contains=ALL syn region mysqlFunction start="bin(" end=")" contains=ALL syn region mysqlFunction start="bit_and(" end=")" contains=ALL diff --git a/runtime/syntax/pf.vim b/runtime/syntax/pf.vim index 1a8f34bbba..81add10e7e 100644 --- a/runtime/syntax/pf.vim +++ b/runtime/syntax/pf.vim @@ -2,30 +2,22 @@ " Language: OpenBSD packet filter configuration (pf.conf) " Original Author: Camiel Dobbelaar <cd@sentia.nl> " Maintainer: Lauri Tirkkonen <lotheac@iki.fi> -" Last Change: 2013 Apr 02 +" Last Change: 2016 Jul 06 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif setlocal foldmethod=syntax +syn iskeyword @,48-57,_,-,+ syn sync fromstart syn cluster pfNotLS contains=pfTodo,pfVarAssign -syn keyword pfCmd altq anchor antispoof binat nat pass -syn keyword pfCmd queue rdr scrub table set -syn keyword pfService auth bgp domain finger ftp http https ident -syn keyword pfService imap irc isakmp kerberos mail nameserver nfs -syn keyword pfService nntp ntp pop3 portmap pptp rpcbind rsync smtp -syn keyword pfService snmp snmptrap socks ssh sunrpc syslog telnet -syn keyword pfService tftp www +syn keyword pfCmd anchor antispoof block include match pass queue +syn keyword pfCmd queue set table +syn match pfCmd /^\s*load\sanchor\>/ syn keyword pfTodo TODO XXX contained syn keyword pfWildAddr all any -syn match pfCmd /block\s/ syn match pfComment /#.*$/ contains=pfTodo syn match pfCont /\\$/ syn match pfErrClose /}/ @@ -34,43 +26,81 @@ syn match pfIPv6 /[a-fA-F0-9:]*::[a-fA-F0-9:.]*/ syn match pfIPv6 /[a-fA-F0-9:]\+:[a-fA-F0-9:]\+:[a-fA-F0-9:.]\+/ syn match pfNetmask /\/\d\+/ syn match pfNum /[a-zA-Z0-9_:.]\@<!\d\+[a-zA-Z0-9_:.]\@!/ -syn match pfTable /<\s*[a-zA-Z][a-zA-Z0-9_]*\s*>/ +syn match pfTable /<\s*[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*\s*>/ syn match pfVar /$[a-zA-Z][a-zA-Z0-9_]*/ syn match pfVarAssign /^\s*[a-zA-Z][a-zA-Z0-9_]*\s*=/me=e-1 syn region pfFold1 start=/^#\{1}>/ end=/^#\{1,3}>/me=s-1 transparent fold syn region pfFold2 start=/^#\{2}>/ end=/^#\{2,3}>/me=s-1 transparent fold syn region pfFold3 start=/^#\{3}>/ end=/^#\{3}>/me=s-1 transparent fold syn region pfList start=/{/ end=/}/ transparent contains=ALLBUT,pfErrClose,@pfNotLS -syn region pfString start=/"/ end=/"/ transparent contains=ALLBUT,pfString,@pfNotLS -syn region pfString start=/'/ end=/'/ transparent contains=ALLBUT,pfString,@pfNotLS +syn region pfString start=/"/ skip=/\\"/ end=/"/ contains=pfIPv4,pfIPv6,pfNetmask,pfTable,pfVar +syn region pfString start=/'/ skip=/\\'/ end=/'/ contains=pfIPv4,pfIPv6,pfNetmask,pfTable,pfVar -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_c_syn_inits") - if version < 508 - let did_c_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +syn keyword pfService 802-11-iapp Microsoft-SQL-Monitor +syn keyword pfService Microsoft-SQL-Server NeXTStep NextStep +syn keyword pfService afpovertcp afs3-bos afs3-callback afs3-errors +syn keyword pfService afs3-fileserver afs3-kaserver afs3-prserver +syn keyword pfService afs3-rmtsys afs3-update afs3-vlserver +syn keyword pfService afs3-volser amt-redir-tcp amt-redir-tls +syn keyword pfService amt-soap-http amt-soap-https asf-rmcp at-echo +syn keyword pfService at-nbp at-rtmp at-zis auth authentication +syn keyword pfService bfd-control bfd-echo bftp bgp bgpd biff bootpc +syn keyword pfService bootps canna cddb cddbp chargen chat cmd +syn keyword pfService cmip-agent cmip-man comsat conference +syn keyword pfService conserver courier csnet-ns cso-ns cvspserver +syn keyword pfService daap datametrics daytime dhcpd-sync +syn keyword pfService dhcpv6-client dhcpv6-server discard domain +syn keyword pfService echo efs eklogin ekshell ekshell2 epmap eppc +syn keyword pfService exec finger ftp ftp-data git gopher hostname +syn keyword pfService hostnames hprop http https hunt hylafax iapp +syn keyword pfService icb ident imap imap2 imap3 imaps ingreslock +syn keyword pfService ipp iprop ipsec-msft ipsec-nat-t ipx irc +syn keyword pfService isakmp iscsi isisd iso-tsap kauth kdc kerberos +syn keyword pfService kerberos-adm kerberos-iv kerberos-sec +syn keyword pfService kerberos_master kf kip klogin kpasswd kpop +syn keyword pfService krb524 krb_prop krbupdate krcmd kreg kshell kx +syn keyword pfService l2tp ldap ldaps ldp link login mail mdns +syn keyword pfService mdnsresponder microsoft-ds ms-sql-m ms-sql-s +syn keyword pfService msa msp mtp mysql name nameserver netbios-dgm +syn keyword pfService netbios-ns netbios-ssn netnews netplan netrjs +syn keyword pfService netstat netwall newdate nextstep nfs nfsd +syn keyword pfService nicname nnsp nntp ntalk ntp null openwebnet +syn keyword pfService ospf6d ospfapi ospfd photuris pop2 pop3 pop3pw +syn keyword pfService pop3s poppassd portmap postgresql postoffice +syn keyword pfService pptp presence printer prospero prospero-np +syn keyword pfService puppet pwdgen qotd quote radacct radius +syn keyword pfService radius-acct rdp readnews remotefs resource rfb +syn keyword pfService rfe rfs rfs_server ripd ripng rje rkinit rlp +syn keyword pfService routed router rpc rpcbind rsync rtelnet rtsp +syn keyword pfService sa-msg-port sane-port sftp shell sieve silc +syn keyword pfService sink sip smtp smtps smux snmp snmp-trap +syn keyword pfService snmptrap snpp socks source spamd spamd-cfg +syn keyword pfService spamd-sync spooler spop3 ssdp ssh submission +syn keyword pfService sunrpc supdup supfiledbg supfilesrv support +syn keyword pfService svn svrloc swat syslog syslog-tls systat +syn keyword pfService tacacs tacas+ talk tap tcpmux telnet tempo +syn keyword pfService tftp time timed timeserver timserver tsap +syn keyword pfService ttylink ttytst ub-dns-control ulistserv untp +syn keyword pfService usenet users uucp uucp-path uucpd vnc vxlan +syn keyword pfService wais webster who whod whois www x400 x400-snd +syn keyword pfService xcept xdmcp xmpp-bosh xmpp-client xmpp-server +syn keyword pfService z3950 zabbix-agent zabbix-trapper zebra +syn keyword pfService zebrasrv - HiLink pfCmd Statement - HiLink pfComment Comment - HiLink pfCont Statement - HiLink pfErrClose Error - HiLink pfIPv4 Type - HiLink pfIPv6 Type - HiLink pfNetmask Constant - HiLink pfNum Constant - HiLink pfService Constant - HiLink pfTable Identifier - HiLink pfTodo Todo - HiLink pfVar Identifier - HiLink pfVarAssign Identifier - HiLink pfWildAddr Type - - delcommand HiLink -endif +hi def link pfCmd Statement +hi def link pfComment Comment +hi def link pfCont Statement +hi def link pfErrClose Error +hi def link pfIPv4 Type +hi def link pfIPv6 Type +hi def link pfNetmask Constant +hi def link pfNum Constant +hi def link pfService Constant +hi def link pfString String +hi def link pfTable Identifier +hi def link pfTodo Todo +hi def link pfVar Identifier +hi def link pfVarAssign Identifier +hi def link pfWildAddr Type let b:current_syntax = "pf" diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index 4e1a84651c..fc257418d0 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: php PHP 3/4/5 " Maintainer: Jason Woofenden <jason@jasonwoof.com> -" Last Change: Dec 26, 2015 +" Last Change: Apr 18, 2016 " URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD " Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com> " Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> @@ -136,7 +136,7 @@ syn keyword phpConstant __LINE__ __FILE__ __FUNCTION__ __METHOD__ __CLASS__ __D " Function and Methods ripped from php_manual_de.tar.gz Jan 2003 syn keyword phpFunctions apache_child_terminate apache_get_modules apache_get_version apache_getenv apache_lookup_uri apache_note apache_request_headers apache_response_headers apache_setenv ascii2ebcdic ebcdic2ascii getallheaders virtual contained -syn keyword phpFunctions array_change_key_case array_chunk array_combine array_count_values array_diff_assoc array_diff_uassoc array_diff array_fill array_filter array_flip array_intersect_assoc array_intersect array_key_exists array_keys array_map array_merge_recursive array_merge array_multisort array_pad array_pop array_push array_rand array_reduce array_reverse array_search array_shift array_slice array_splice array_sum array_udiff_assoc array_udiff_uassoc array_udiff array_unique array_unshift array_values array_walk array arsort asort compact count current each end extract in_array key krsort ksort list natcasesort natsort next pos prev range reset rsort shuffle sizeof sort uasort uksort usort contained +syn keyword phpFunctions array_change_key_case array_chunk array_column array_combine array_count_values array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_diff array_fill_keys array_fill array_filter array_flip array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_intersect array_key_exists array_keys array_map array_merge_recursive array_merge array_multisort array_pad array_pop array_product array_push array_rand array_reduce array_replace_recursive array_replace array_reverse array_search array_shift array_slice array_splice array_sum array_udiff_assoc array_udiff_uassoc array_udiff array_uintersect_assoc array_uintersect_uassoc array_uintersect array_unique array_unshift array_values array_walk_recursive array_walk arsort asort count current each end in_array key_exists key krsort ksort natcasesort natsort next pos prev range reset rsort shuffle sizeof sort uasort uksort usort contained syn keyword phpFunctions aspell_check aspell_new aspell_suggest contained syn keyword phpFunctions bcadd bccomp bcdiv bcmod bcmul bcpow bcpowmod bcscale bcsqrt bcsub contained syn keyword phpFunctions bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite contained diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index 78d35e4c15..fa42b3e2d2 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic <zpetkovic@acm.org> -" Last Change: 2015 Sep 15 +" Last Change: 2016 Jul 21 " Credits: Neil Schemenauer <nas@python.ca> " Dmitry Vasiliev " @@ -72,7 +72,7 @@ set cpo&vim " built-in below (use 'from __future__ import print_function' in 2) " - async and await were added in Python 3.5 and are soft keywords. " -syn keyword pythonStatement False, None, True +syn keyword pythonStatement False None True syn keyword pythonStatement as assert break continue del exec global syn keyword pythonStatement lambda nonlocal pass print return with yield syn keyword pythonStatement class def nextgroup=pythonFunction skipwhite @@ -199,6 +199,8 @@ if !exists("python_no_builtin_highlight") syn keyword pythonBuiltin ascii bytes exec " non-essential built-in functions; Python 2 only syn keyword pythonBuiltin apply buffer coerce intern + " avoid highlighting attributes as builtins + syn match pythonAttribute /\.\h\w*/hs=s+1 contains=ALLBUT,pythonBuiltin transparent endif " From the 'Python Library Reference' class hierarchy at the bottom. diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim index e48b6686cb..d96bf96acb 100644 --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -5,17 +5,21 @@ " Tom Payne <tom@tompayne.org> " Contributor: Johannes Ranke <jranke@uni-bremen.de> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed Oct 21, 2015 06:33AM +" Last Change: Thu Mar 10, 2016 12:26PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in " runtime files created by a filetype plugin, if installed. " " CONFIGURATION: -" syntax folding can be turned on by +" Syntax folding can be turned on by " " let r_syntax_folding = 1 " +" ROxygen highlighting can be turned off by +" +" let r_hl_roxygen = 0 +" " Some lines of code were borrowed from Zhuojun Chen. if exists("b:current_syntax") @@ -24,9 +28,12 @@ endif setlocal iskeyword=@,48-57,_,. -if exists("g:r_syntax_folding") +if exists("g:r_syntax_folding") && g:r_syntax_folding setlocal foldmethod=syntax endif +if !exists("g:r_hl_roxygen") + let g:r_hl_roxygen = 1 +endif syn case match @@ -35,18 +42,20 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*" " Roxygen -syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend -syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey -syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained - -syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword - -syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)" -syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" -syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" -syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)" -syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" -syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)" +if g:r_hl_roxygen + syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend + syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey + syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained + + syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword + + syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)" + syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" + syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" + syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)" + syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" + syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)" +endif if &filetype == "rhelp" @@ -159,12 +168,13 @@ syn match rBraceError "[)}]" contained syn match rCurlyError "[)\]]" contained syn match rParenError "[\]}]" contained -" Source list of R functions produced by a filetype plugin (if installed) -if has("nvim") - " Nvim-R +if !exists("g:R_hi_fun") + let g:R_hi_fun = 1 +endif +if g:R_hi_fun + " Nvim-R: runtime R/functions.vim -else - " Vim-R-plugin + " Vim-R-plugin: runtime r-plugin/functions.vim endif @@ -235,11 +245,13 @@ hi def link rStatement Statement hi def link rString String hi def link rStrError Error hi def link rType Type -hi def link rOKeyword Title -hi def link rOBlock Comment -hi def link rOTitle Title -hi def link rOCommentKey Comment -hi def link rOExamples SpecialComment +if g:r_hl_roxygen + hi def link rOKeyword Title + hi def link rOBlock Comment + hi def link rOTitle Title + hi def link rOCommentKey Comment + hi def link rOExamples SpecialComment +endif let b:current_syntax="r" diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim index 32c91add48..47c764e296 100644 --- a/runtime/syntax/rhelp.vim +++ b/runtime/syntax/rhelp.vim @@ -2,25 +2,21 @@ " Language: R Help File " Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Former Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: Wed Jul 09, 2014 10:28PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Feb 06, 2016 11:34AM " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. " - There is no Latex markup in equations " - Thanks to Will Gray for finding and fixing a bug -" - No support for \if, \ifelse and \out as I don't understand -" them and have no examples at hand (help welcome). -" - No support for \var tag within quoted string (dito) +" - No support for \var tag within quoted string " Version Clears: {{{1 -" For version 5.x: Clear all syntax items -" For version 6.x and 7.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif +scriptencoding utf-8 setlocal iskeyword=@,48-57,_,. syn case match @@ -29,9 +25,11 @@ syn case match syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}" syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}" syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}" contains=rhelpLink +syn region rhelpIdentifier matchgroup=rhelpSection start="\\CRANpkg{" end="}" contains=rhelpLink syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end="}" contained syn region rhelpIdentifier matchgroup=rhelpSection start="\\Rdversion{" end="}" + " Highlighting of R code using an existing r.vim syntax file if available {{{1 syn include @R syntax/r.vim @@ -69,76 +67,115 @@ syn match rhelpDelimiter "\\cr" syn match rhelpDelimiter "\\tab " " Keywords {{{1 -syn match rhelpKeyword "\\R" -syn match rhelpKeyword "\\ldots" +syn match rhelpKeyword "\\R\>" +syn match rhelpKeyword "\\ldots\>" +syn match rhelpKeyword "\\sspace\>" syn match rhelpKeyword "--" syn match rhelpKeyword "---" -syn match rhelpKeyword "<" -syn match rhelpKeyword ">" -syn match rhelpKeyword "\\ge" -syn match rhelpKeyword "\\le" -syn match rhelpKeyword "\\alpha" -syn match rhelpKeyword "\\beta" -syn match rhelpKeyword "\\gamma" -syn match rhelpKeyword "\\delta" -syn match rhelpKeyword "\\epsilon" -syn match rhelpKeyword "\\zeta" -syn match rhelpKeyword "\\eta" -syn match rhelpKeyword "\\theta" -syn match rhelpKeyword "\\iota" -syn match rhelpKeyword "\\kappa" -syn match rhelpKeyword "\\lambda" -syn match rhelpKeyword "\\mu" -syn match rhelpKeyword "\\nu" -syn match rhelpKeyword "\\xi" -syn match rhelpKeyword "\\omicron" -syn match rhelpKeyword "\\pi" -syn match rhelpKeyword "\\rho" -syn match rhelpKeyword "\\sigma" -syn match rhelpKeyword "\\tau" -syn match rhelpKeyword "\\upsilon" -syn match rhelpKeyword "\\phi" -syn match rhelpKeyword "\\chi" -syn match rhelpKeyword "\\psi" -syn match rhelpKeyword "\\omega" -syn match rhelpKeyword "\\Alpha" -syn match rhelpKeyword "\\Beta" -syn match rhelpKeyword "\\Gamma" -syn match rhelpKeyword "\\Delta" -syn match rhelpKeyword "\\Epsilon" -syn match rhelpKeyword "\\Zeta" -syn match rhelpKeyword "\\Eta" -syn match rhelpKeyword "\\Theta" -syn match rhelpKeyword "\\Iota" -syn match rhelpKeyword "\\Kappa" -syn match rhelpKeyword "\\Lambda" -syn match rhelpKeyword "\\Mu" -syn match rhelpKeyword "\\Nu" -syn match rhelpKeyword "\\Xi" -syn match rhelpKeyword "\\Omicron" -syn match rhelpKeyword "\\Pi" -syn match rhelpKeyword "\\Rho" -syn match rhelpKeyword "\\Sigma" -syn match rhelpKeyword "\\Tau" -syn match rhelpKeyword "\\Upsilon" -syn match rhelpKeyword "\\Phi" -syn match rhelpKeyword "\\Chi" -syn match rhelpKeyword "\\Psi" -syn match rhelpKeyword "\\Omega" -" Links {{{1 -syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend extend -syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend extend -syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend +" Condition Keywords {{{2 +syn match rhelpKeyword "\\if\>" +syn match rhelpKeyword "\\ifelse\>" +syn match rhelpKeyword "\\out\>" +" Examples of usage: +" \ifelse{latex}{\eqn{p = 5 + 6 - 7 \times 8}}{\eqn{p = 5 + 6 - 7 * 8}} +" \ifelse{latex}{\out{$\alpha$}}{\ifelse{html}{\out{α}}{alpha}} -" Verbatim like {{{1 -if v:version > 703 - syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment - syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment +" Keywords and operators valid only if in math mode {{{2 +syn match rhelpMathOp "<" contained +syn match rhelpMathOp ">" contained +syn match rhelpMathOp "+" contained +syn match rhelpMathOp "-" contained +syn match rhelpMathOp "=" contained + +" Conceal function based on syntax/tex.vim {{{2 +if exists("g:tex_conceal") + let s:tex_conceal = g:tex_conceal else - syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment - syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment + let s:tex_conceal = 'gm' endif +function s:HideSymbol(pat, cchar, hide) + if a:hide + exe "syn match rhelpMathSymb '" . a:pat . "' contained conceal cchar=" . a:cchar + else + exe "syn match rhelpMathSymb '" . a:pat . "' contained" + endif +endfunction + +" Math symbols {{{2 +if s:tex_conceal =~ 'm' + let s:hd = 1 +else + let s:hd = 0 +endif +call s:HideSymbol('\\infty\>', '∞', s:hd) +call s:HideSymbol('\\ge\>', '≥', s:hd) +call s:HideSymbol('\\le\>', '≤', s:hd) +call s:HideSymbol('\\prod\>', 'âˆ', s:hd) +call s:HideSymbol('\\sum\>', '∑', s:hd) +syn match rhelpMathSymb "\\sqrt\>" contained + +" Greek letters {{{2 +if s:tex_conceal =~ 'g' + let s:hd = 1 +else + let s:hd = 0 +endif +call s:HideSymbol('\\alpha\>', 'α', s:hd) +call s:HideSymbol('\\beta\>', 'β', s:hd) +call s:HideSymbol('\\gamma\>', 'γ', s:hd) +call s:HideSymbol('\\delta\>', 'δ', s:hd) +call s:HideSymbol('\\epsilon\>', 'ϵ', s:hd) +call s:HideSymbol('\\zeta\>', 'ζ', s:hd) +call s:HideSymbol('\\eta\>', 'η', s:hd) +call s:HideSymbol('\\theta\>', 'θ', s:hd) +call s:HideSymbol('\\iota\>', 'ι', s:hd) +call s:HideSymbol('\\kappa\>', 'κ', s:hd) +call s:HideSymbol('\\lambda\>', 'λ', s:hd) +call s:HideSymbol('\\mu\>', 'μ', s:hd) +call s:HideSymbol('\\nu\>', 'ν', s:hd) +call s:HideSymbol('\\xi\>', 'ξ', s:hd) +call s:HideSymbol('\\pi\>', 'Ï€', s:hd) +call s:HideSymbol('\\rho\>', 'Ï', s:hd) +call s:HideSymbol('\\sigma\>', 'σ', s:hd) +call s:HideSymbol('\\tau\>', 'Ï„', s:hd) +call s:HideSymbol('\\upsilon\>', 'Ï…', s:hd) +call s:HideSymbol('\\phi\>', 'Ï•', s:hd) +call s:HideSymbol('\\chi\>', 'χ', s:hd) +call s:HideSymbol('\\psi\>', 'ψ', s:hd) +call s:HideSymbol('\\omega\>', 'ω', s:hd) +call s:HideSymbol('\\Gamma\>', 'Γ', s:hd) +call s:HideSymbol('\\Delta\>', 'Δ', s:hd) +call s:HideSymbol('\\Theta\>', 'Θ', s:hd) +call s:HideSymbol('\\Lambda\>', 'Λ', s:hd) +call s:HideSymbol('\\Xi\>', 'Ξ', s:hd) +call s:HideSymbol('\\Pi\>', 'Î ', s:hd) +call s:HideSymbol('\\Sigma\>', 'Σ', s:hd) +call s:HideSymbol('\\Upsilon\>', 'Î¥', s:hd) +call s:HideSymbol('\\Phi\>', 'Φ', s:hd) +call s:HideSymbol('\\Psi\>', 'Ψ', s:hd) +call s:HideSymbol('\\Omega\>', 'Ω', s:hd) +delfunction s:HideSymbol +" Note: The letters 'omicron', 'Alpha', 'Beta', 'Epsilon', 'Zeta', 'Eta', +" 'Iota', 'Kappa', 'Mu', 'Nu', 'Omicron', 'Rho', 'Tau' and 'Chi' are listed +" at src/library/tools/R/Rd2txt.R because they are valid in HTML, although +" they do not make valid LaTeX code (e.g. Α versus \Alpha). + +" Links {{{1 +syn region rhelpLink matchgroup=rhelpType start="\\link{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\link\[.\{-}\]{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\linkS4class{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\url{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\href{" end="}" contained keepend extend +syn region rhelpLink matchgroup=rhelpType start="\\figure{" end="}" contained keepend extend + +" Verbatim like {{{1 +syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment +syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment + +" Equation {{{1 +syn region rhelpEquation matchgroup=rhelpType start="\\eqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend +syn region rhelpEquation matchgroup=rhelpType start="\\deqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend " Type Styles {{{1 syn match rhelpType "\\emph\>" @@ -148,12 +185,9 @@ syn match rhelpType "\\sQuote\>" syn match rhelpType "\\dQuote\>" syn match rhelpType "\\preformatted\>" syn match rhelpType "\\kbd\>" -syn match rhelpType "\\eqn\>" -syn match rhelpType "\\deqn\>" syn match rhelpType "\\file\>" syn match rhelpType "\\email\>" -syn match rhelpType "\\url\>" -syn match rhelpType "\\href\>" +syn match rhelpType "\\enc\>" syn match rhelpType "\\var\>" syn match rhelpType "\\env\>" syn match rhelpType "\\option\>" @@ -163,6 +197,7 @@ syn match rhelpType "\\renewcommand\>" syn match rhelpType "\\dfn\>" syn match rhelpType "\\cite\>" syn match rhelpType "\\acronym\>" +syn match rhelpType "\\doi\>" " rhelp sections {{{1 syn match rhelpSection "\\encoding\>" @@ -202,9 +237,9 @@ syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}" syn match rhelpComment /%.*$/ " Error {{{1 -syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim -syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim -syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim +syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation +syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation +syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation syn match rhelpError /[)\]}]/ syn match rhelpBraceError /[)}]/ contained syn match rhelpCurlyError /[)\]]/ contained @@ -213,36 +248,27 @@ syn match rhelpParenError /[\]}]/ contained syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{" " Define the default highlighting {{{1 -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_rhelp_syntax_inits") - if version < 508 - let did_rhelp_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - HiLink rhelpVerbatim String - HiLink rhelpDelimiter Delimiter - HiLink rhelpIdentifier Identifier - HiLink rhelpString String - HiLink rhelpCodeSpecial Special - HiLink rhelpKeyword Keyword - HiLink rhelpDots Keyword - HiLink rhelpLink Underlined - HiLink rhelpType Type - HiLink rhelpSection PreCondit - HiLink rhelpError Error - HiLink rhelpBraceError Error - HiLink rhelpCurlyError Error - HiLink rhelpParenError Error - HiLink rhelpPreProc PreProc - HiLink rhelpDelimiter Delimiter - HiLink rhelpComment Comment - HiLink rhelpRComment Comment - HiLink rhelpSpecialChar SpecialChar - delcommand HiLink -endif +hi def link rhelpVerbatim String +hi def link rhelpDelimiter Delimiter +hi def link rhelpIdentifier Identifier +hi def link rhelpString String +hi def link rhelpCodeSpecial Special +hi def link rhelpKeyword Keyword +hi def link rhelpDots Keyword +hi def link rhelpLink Underlined +hi def link rhelpType Type +hi def link rhelpSection PreCondit +hi def link rhelpError Error +hi def link rhelpBraceError Error +hi def link rhelpCurlyError Error +hi def link rhelpParenError Error +hi def link rhelpPreProc PreProc +hi def link rhelpDelimiter Delimiter +hi def link rhelpComment Comment +hi def link rhelpRComment Comment +hi def link rhelpSpecialChar SpecialChar +hi def link rhelpMathSymb Special +hi def link rhelpMathOp Operator let b:current_syntax = "rhelp" diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index 6f1b847453..4cde7441d3 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,15 +1,13 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Wed Jul 09, 2014 10:29PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Feb 06, 2016 06:45AM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: " let rmd_syn_hl_chunk = 1 -" for portability -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -58,6 +56,8 @@ if rmdIsPandoc == 0 if exists("b:current_syntax") unlet b:current_syntax endif + " Extend cluster + syn cluster texMathZoneGroup add=rmdrInline " Inline syntax match rmdLaTeXInlDelim "\$" syntax match rmdLaTeXInlDelim "\\\$" diff --git a/runtime/syntax/rnoweb.vim b/runtime/syntax/rnoweb.vim index 7d42395b5c..665acc53e2 100644 --- a/runtime/syntax/rnoweb.vim +++ b/runtime/syntax/rnoweb.vim @@ -1,20 +1,14 @@ " Vim syntax file " Language: R noweb Files " Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: 2009 May 05 -" Version: 0.9 -" SVN: $Id: rnoweb.vim 84 2009-05-03 19:52:47Z ranke $ +" Last Change: Sat Feb 06, 2016 06:47AM +" Version: 0.9.1 " Remarks: - This file is inspired by the proposal of -" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br> -" http://www.ime.usp.br/~feferraz/en/sweavevim.html +" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br> +" http://www.ime.usp.br/~feferraz/en/sweavevim.html " -" Version Clears: {{{1 -" For version 5.x: Clear all syntax items -" For version 6.x and 7.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -26,21 +20,22 @@ unlet b:current_syntax syn cluster texMatchGroup add=@rnoweb syn cluster texMathMatchGroup add=rnowebSexpr +syn cluster texMathZoneGroup add=rnowebSexpr syn cluster texEnvGroup add=@rnoweb syn cluster texFoldGroup add=@rnoweb -syn cluster texDocGroup add=@rnoweb -syn cluster texPartGroup add=@rnoweb -syn cluster texChapterGroup add=@rnoweb -syn cluster texSectionGroup add=@rnoweb -syn cluster texSubSectionGroup add=@rnoweb -syn cluster texSubSubSectionGroup add=@rnoweb -syn cluster texParaGroup add=@rnoweb +syn cluster texDocGroup add=@rnoweb +syn cluster texPartGroup add=@rnoweb +syn cluster texChapterGroup add=@rnoweb +syn cluster texSectionGroup add=@rnoweb +syn cluster texSubSectionGroup add=@rnoweb +syn cluster texSubSubSectionGroup add=@rnoweb +syn cluster texParaGroup add=@rnoweb " Highlighting of R code using an existing r.vim syntax file if available {{{1 syn include @rnowebR syntax/r.vim syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend syn match rnowebChunkReference "^<<.*>>$" contained -syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR +syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained " Sweave options command {{{1 syn region rnowebSweaveopts matchgroup=Delimiter start="\\SweaveOpts{" matchgroup=Delimiter end="}" diff --git a/runtime/syntax/rrst.vim b/runtime/syntax/rrst.vim index 4667b3a2c1..24d3844df0 100644 --- a/runtime/syntax/rrst.vim +++ b/runtime/syntax/rrst.vim @@ -1,16 +1,14 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Wed Jul 09, 2014 10:29PM +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Sat Feb 06, 2016 06:45AM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: " let rrst_syn_hl_chunk = 1 -" for portability -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index 8b17104be4..ef07b22676 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -2,7 +2,7 @@ " Language: reStructuredText documentation format " Maintainer: Marshall Ward <marshall.ward@gmail.com> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2015-09-07 +" Latest Revision: 2016-06-17 if exists("b:current_syntax") finish @@ -13,8 +13,6 @@ set cpo&vim syn case ignore -syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" - syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/ syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis, @@ -123,6 +121,8 @@ call s:DefineInlineMarkup('InlineLiteral', '``', "", '``') call s:DefineInlineMarkup('SubstitutionReference', '|', '|', '|_\{0,2}') call s:DefineInlineMarkup('InlineInternalTargets', '_`', '`', '`') +syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" + " TODO: Can’t remember why these two can’t be defined like the ones above. execute 'syn match rstFootnoteReference contains=@NoSpell' . \ ' +\[\%(\d\+\|#\%(' . s:ReferenceName . '\)\=\|\*\)\]_+' @@ -137,7 +137,7 @@ syn match rstStandaloneHyperlink contains=@NoSpell \ "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]" syn region rstCodeBlock contained matchgroup=rstDirective - \ start=+\%(sourcecode\|code\%(-block\)\=\)::\_s*\n\ze\z(\s\+\)+ + \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s\+\w*\_s*\n\ze\z(\s\+\)+ \ skip=+^$+ \ end=+^\z1\@!+ \ contains=@NoSpell @@ -153,10 +153,11 @@ for code in g:rst_syntax_code_list " guard against setting 'isk' option which might cause problems (issue #108) let prior_isk = &l:iskeyword exe 'syn include @rst'.code.' syntax/'.code.'.vim' - exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold ' - \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\_s*\n\ze\z(\s\+\)# ' - \.'skip=#^$# ' - \.'end=#^\z1\@!# contains=@NoSpell,@rst'.code + exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold' + \.' start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\_s*\n\ze\z(\s\+\)#' + \.' skip=#^$#' + \.' end=#^\z1\@!#' + \.' contains=@NoSpell,@rst'.code exe 'syn cluster rstDirectives add=rstDirective'.code " reset 'isk' setting, if it has been changed if &l:iskeyword !=# prior_isk @@ -185,10 +186,11 @@ hi def link rstHyperlinkTarget String hi def link rstExDirective String hi def link rstSubstitutionDefinition rstDirective hi def link rstDelimiter Delimiter -" TODO: I dunno... -hi def rstEmphasis term=italic cterm=italic gui=italic +hi def link rstEmphasis Underlined hi def link rstStrongEmphasis Special -"term=bold cterm=bold gui=bold +" TODO Append these atttributes somehow +"hi def rstEmphasis term=italic cterm=italic gui=italic +"hi def rstStrongEmphasis term=bold cterm=bold gui=bold hi def link rstInterpretedTextOrHyperlinkReference Identifier hi def link rstInlineLiteral String hi def link rstSubstitutionReference PreProc diff --git a/runtime/syntax/scheme.vim b/runtime/syntax/scheme.vim index a210b0c720..c59e09cd17 100644 --- a/runtime/syntax/scheme.vim +++ b/runtime/syntax/scheme.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Scheme (R5RS + some R6RS extras) -" Last Change: 2012 May 13 +" Last Change: 2016 May 23 " Maintainer: Sergey Khorev <sergey.khorev@gmail.com> " Original author: Dirk van Deun <dirk@igwe.vub.ac.be> @@ -245,6 +245,18 @@ if exists("b:is_mzscheme") || exists("is_mzscheme") syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL + + " Identifiers are very liberal in MzScheme/Racket + syn match schemeOther ![^()[\]{}",'`;#|\\ ]\+! + + " Language setting + syn match schemeLang "#lang [-+_/A-Za-z0-9]\+\>" + + " Various number forms + syn match schemeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>" + syn match schemeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>" + syn match schemeNumber "[-+]\=[0-9]\+/[0-9]\+\>" + syn match schemeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>" endif @@ -321,6 +333,9 @@ if version >= 508 || !exists("did_scheme_syntax_inits") HiLink schemeExtSyntax Type HiLink schemeExtFunc PreProc + + HiLink schemeLang PreProc + delcommand HiLink endif diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index efe0bcb461..711971ea4a 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,15 +2,15 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> -" Last Change: Nov 09, 2015 -" Version: 142 +" Last Change: Jun 10, 2016 +" Version: 152 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) " For version 5.x: Clear all syntax items {{{1 " For version 6.x: Quit when a syntax file was already loaded -if version < 600 +if v:version < 600 syntax clear elseif exists("b:current_syntax") finish @@ -18,19 +18,25 @@ endif " trying to answer the question: which shell is /bin/sh, really? " If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess. -if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh") +if getline(1) =~ '\<ksh$' + let b:is_kornshell = 1 +elseif getline(1) =~ '\<bash$' + let b:is_bash = 1 +elseif getline(1) =~ '\<dash$' + let b:is_posix = 1 +elseif !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh") let s:shell = "" if executable("/bin/sh") let s:shell = resolve("/bin/sh") elseif executable("/usr/bin/sh") let s:shell = resolve("/usr/bin/sh") endif - if s:shell =~ 'bash$' - let g:is_bash= 1 - elseif s:shell =~ 'ksh$' - let g:is_kornshell = 1 + if s:shell =~ 'ksh$' + let b:is_kornshell= 1 + elseif s:shell =~ 'bash$' + let b:is_bash = 1 elseif s:shell =~ 'dash$' - let g:is_posix = 1 + let b:is_posix = 1 endif unlet s:shell endif @@ -85,6 +91,15 @@ if g:sh_fold_enabled && &fdm == "manual" setl fdm=syntax endif +" set up the syntax-highlighting iskeyword +if has("patch-7.4.1142") + if exists("b:is_bash") + exe "syn iskeyword ".&iskeyword.",-,:" + else + exe "syn iskeyword ".&iskeyword.",-" + endif +endif + " Set up folding commands for shell {{{1 " ================================= if s:sh_fold_functions @@ -119,7 +134,7 @@ syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSu syn cluster shCommandSubList contains=shAlias,shArithmetic,shComment,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shOption,shPosnParm,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial -syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS +syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shEscape,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq @@ -135,6 +150,7 @@ syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch +syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr @@ -157,7 +173,7 @@ if exists("b:is_kornshell") || exists("b:is_bash") " Touch: {{{1 " ===== - syn match shTouch '\<touch\>[^;#]*' skipwhite nextgroup=shTouchList contains=shTouchCmd + syn match shTouch '\<touch\>[^;#]*' skipwhite nextgroup=shComment contains=shTouchCmd syn match shTouchCmd '\<touch\>' contained endif @@ -180,7 +196,7 @@ endif " Options: {{{1 " ==================== -syn match shOption "\s\zs[-+][-_a-zA-Z0-9#]\+" +syn match shOption "\s\zs[-+][-_a-zA-Z#@]\+" syn match shOption "\s\zs--[^ \t$`'"|);]\+" " File Redirection Highlighted As Operators: {{{1 @@ -208,14 +224,15 @@ syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 syn region shNoQuote start='\S' skip='\%(\\\\\)*\\.' end='\ze\s' contained +syn match shAstQuote contained '\*\ze"' nextgroup=shString syn match shTestOpr contained '[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern syn match shTestOpr contained "<=\|>=\|!=\|==\|=\~\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" syn match shTestPattern contained '\w\+' -syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' +syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' contains=shDeref,shDerefSimple,shDerefSpecial syn match shTestSingleQuote contained '\\.' syn match shTestSingleQuote contained "'[^']*'" if exists("b:is_kornshell") || exists("b:is_bash") - syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shNoQuote,shComment + syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shAstQuote,shNoQuote,shComment syn region shDblParen matchgroup=Delimiter start="((" skip=+\%(\\\\\)*\\$+ end="))" contains=@shTestList,shComment endif @@ -308,14 +325,18 @@ syn match shSource "^\.\s" syn match shSource "\s\.\s" "syn region shColon start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList "syn region shColon start="^\s*\zs:" end="$" end="\s#"me=e-2 -syn match shColon '^\s*\zs:' +if exists("b:is_kornshell") + syn match shColon '^\s*\zs:' +endif " String And Character Constants: {{{1 "================================ -syn match shNumber "-\=\<\d\+\>#\=" -syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained +syn match shNumber "\<\d\+\>#\=" +syn match shNumber "-\=\.\=\d\+\>#\=" +syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained if exists("b:is_bash") - syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained + syn match shSpecial "[^\\]\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained + syn match shSpecial "^\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained endif if exists("b:is_bash") syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial @@ -326,11 +347,13 @@ elseif !exists("g:sh_no_error") endif syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell -syn match shStringSpecial "[^[:print:] \t]" contained -syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" -syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" +syn match shStringSpecial "[^[:print:] \t]" contained +syn match shStringSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" +syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shBkslshSnglQuote,shBkslshDblQuote syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" -syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained +syn match shMoreSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained +syn region shBkslshSnglQuote contained matchgroup=shQuote start=+'+ end=+'+ contains=@Spell +syn region shBkslshDblQuote contained matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell " Comments: {{{1 "========== @@ -343,31 +366,21 @@ syn match shQuickComment contained "#.*$" " Here Documents: {{{1 " ========================================= -if version < 600 - syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shHereDoc01 end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc02 start="<<-\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shHereDoc02 end="^\s*END[a-zA-Z_0-9]*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc03 start="<<\s*\**EOF\**" matchgroup=shHereDoc03 end="^EOF$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*\**EOF\**" matchgroup=shHereDoc04 end="^\s*EOF$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*\**\.\**" matchgroup=shHereDoc05 end="^\.$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\**\.\**" matchgroup=shHereDoc06 end="^\s*\.$" contains=@shDblQuoteList - -else - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\=\z([^ \t|]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc08 end="^\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<-\s*\z([^ \t|]\+\)" matchgroup=shHereDoc09 end="^\s*\z1\s*$" contains=@shDblQuoteList - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc10 end="^\s*\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc11 end="^\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc12 end="^\s*\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc13 end="^\z1\s*$" contains=@shDblQuoteList - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc14 end="^\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc15 end="^\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc16 end="^\s*\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc17 start="<<-\s*\\\_$\_s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc17 end="^\s*\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc18 start="<<-\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc18 end="^\s*\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc19 start="<<-\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc19 end="^\s*\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc20 start="<<\\\z([^ \t|]\+\)" matchgroup=shHereDoc20 end="^\z1\s*$" - ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc21 start="<<-\s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc21 end="^\s*\z1\s*$" -endif +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\\\=\z([^ \t|]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t|]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc04 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t|]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" " Here Strings: {{{1 " ============= @@ -398,21 +411,21 @@ if !exists("g:is_posix") endif if exists("b:is_bash") - ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else - ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment endif " Parameter Dereferencing: {{{1 " ======================== if !exists("g:sh_no_error") - syn match shDerefWordError "[^}$[]" contained + syn match shDerefWordError "[^}$[~]" contained endif syn match shDerefSimple "\$\%(\k\+\|\d\)" syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray @@ -492,7 +505,12 @@ if exists("b:is_bash") " bash : ${parameter//pattern} syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList - syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shCommandSubList + syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList + + " bash : ${parameter/#substring/replacement} + syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft + syn region shDerefPSRleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright + syn region shDerefPSRright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' endif " Arithmetic Parenthesized Expressions: {{{1 @@ -528,13 +546,20 @@ endif " Synchronization: {{{1 " ================ -if !exists("sh_minlines") - let sh_minlines = 200 +if !exists("g:sh_minlines") + let s:sh_minlines = 200 +else + let s:sh_minlines= g:sh_minlines endif -if !exists("sh_maxlines") - let sh_maxlines = 2 * sh_minlines +if !exists("g:sh_maxlines") + let s:sh_maxlines = 2*s:sh_minlines + if s:sh_maxlines < 25 + let s:sh_maxlines= 25 + endif +else + let s:sh_maxlines= g:sh_maxlines endif -exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines +exec "syn sync minlines=" . s:sh_minlines . " maxlines=" . s:sh_maxlines syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>" syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>" syn sync match shDoSync grouphere shDo "\<do\>" @@ -549,6 +574,7 @@ syn sync match shWhileSync grouphere shRepeat "\<while\>" " Default Highlighting: {{{1 " ===================== hi def link shArithRegion shShellVariables +hi def link shAstQuote shDoubleQuote hi def link shAtExpr shSetList hi def link shBeginHere shRedir hi def link shCaseBar shConditional @@ -563,6 +589,7 @@ hi def link shColon shComment hi def link shDerefOp shOperator hi def link shDerefPOL shDerefOp hi def link shDerefPPS shDerefOp +hi def link shDerefPSR shDerefOp hi def link shDeref shShellVariables hi def link shDerefDelim shOperator hi def link shDerefSimple shDeref @@ -578,7 +605,6 @@ hi def link shEmbeddedEcho shString hi def link shEscape shCommandSub hi def link shExDoubleQuote shDoubleQuote hi def link shExSingleQuote shSingleQuote -hi def link shFunction Function hi def link shHereDoc shString hi def link shHerePayload shHereDoc hi def link shLoop shStatement @@ -609,21 +635,17 @@ if exists("b:is_bash") hi def link bashAdminStatement shStatement hi def link bashSpecialVariables shShellVariables hi def link bashStatement shStatement - hi def link shFunctionParen Delimiter - hi def link shFunctionDelim Delimiter hi def link shCharClass shSpecial endif if exists("b:is_kornshell") hi def link kshSpecialVariables shShellVariables hi def link kshStatement shStatement - hi def link shFunctionParen Delimiter endif if !exists("g:sh_no_error") hi def link shCaseError Error hi def link shCondError Error hi def link shCurlyError Error - hi def link shDerefError Error hi def link shDerefOpError Error hi def link shDerefWordError Error hi def link shDoError Error @@ -673,12 +695,6 @@ hi def link shHereDoc12 shRedir hi def link shHereDoc13 shRedir hi def link shHereDoc14 shRedir hi def link shHereDoc15 shRedir -hi def link shHereDoc16 shRedir -hi def link shHereDoc17 shRedir -hi def link shHereDoc18 shRedir -hi def link shHereDoc19 shRedir -hi def link shHereDoc20 shRedir -hi def link shHereDoc21 shRedir " Delete shell folding commands {{{1 " ============================= diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim index 5d96b57a8a..9952bd2548 100644 --- a/runtime/syntax/spec.vim +++ b/runtime/syntax/spec.vim @@ -3,7 +3,7 @@ " Language: SPEC: Build/install scripts for Linux RPM packages " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Donovan Rebbechi elflord@panix.com (until March 2014) -" Last Change: Sun Mar 2 10:33 MSK 2014 Igor Gnatenko +" Last Change: Sat Apr 9 15:30 2016 Filip SzymaÅ„ski " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -83,8 +83,8 @@ syn keyword specMacroNameLocal contained _arch _binary_payload _bindir _build _b "One line macros - valid in all ScriptAreas "tip: remember do include new items on specScriptArea's skip section -syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|global\|patch\d*\|setup\|configure\|GNUconfigure\|find_lang\|makeinstall\|make_install\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier -syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure\|GNUconfigure\|find_lang\|makeinstall\|make_install\)}' end='$' contains=specCommandOpts,specMacroIdentifier +syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|global\|patch\d*\|setup\|autosetup\|autopatch\|configure\|GNUconfigure\|find_lang\|make_build\|makeinstall\|make_install\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier +syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure\|GNUconfigure\|find_lang\|make_build\|makeinstall\|make_install\)}' end='$' contains=specCommandOpts,specMacroIdentifier "%% Files Section %% "TODO %config valid parameters: missingok\|noreplace @@ -105,7 +105,7 @@ syn case ignore "%% PreAmble Section %% "Copyright and Serial were deprecated by License and Epoch syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier -syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier +syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier "%% Description Section %% syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment @@ -114,7 +114,7 @@ syn region specDescriptionArea matchgroup=specSection start='^%description' end= syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment "%% Scripts Section %% -syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|find_lang\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 +syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2 "%% Changelog Section %% syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense diff --git a/runtime/syntax/sqloracle.vim b/runtime/syntax/sqloracle.vim index 8afe2686bf..f9e24af98c 100644 --- a/runtime/syntax/sqloracle.vim +++ b/runtime/syntax/sqloracle.vim @@ -4,7 +4,12 @@ " Repository: https://github.com/chrisbra/vim-sqloracle-syntax " License: Vim " Previous Maintainer: Paul Moore -" Last Change: 2015 Nov 24 +" Last Change: 2016 Jul 22 + +" Changes: +" 02.04.2016: Support for when keyword +" 03.04.2016: Support for join related keywords +" 22.07.2016: Support Oracle Q-Quote-Syntax if exists("b:current_syntax") finish @@ -24,10 +29,11 @@ syn keyword sqlKeyword index initial initrans into is level link logging loop syn keyword sqlKeyword maxextents maxtrans mode modify monitoring syn keyword sqlKeyword nocache nocompress nologging noparallel nowait of offline on online start syn keyword sqlKeyword parallel successful synonym table tablespace then to trigger uid -syn keyword sqlKeyword unique user validate values view whenever +syn keyword sqlKeyword unique user validate values view when whenever syn keyword sqlKeyword where with option order pctfree pctused privileges procedure syn keyword sqlKeyword public resource return row rowlabel rownum rows syn keyword sqlKeyword session share size smallint type using +syn keyword sqlKeyword join cross inner outer left right syn keyword sqlOperator not and or syn keyword sqlOperator in any some all between exists @@ -47,8 +53,13 @@ syn keyword sqlType boolean char character date float integer long syn keyword sqlType mlslabel number raw rowid varchar varchar2 varray " Strings: -syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+ +syn region sqlString matchgroup=Quote start=+"+ skip=+\\\\\|\\"+ end=+"+ +syn region sqlString matchgroup=Quote start=+'+ skip=+\\\\\|\\'+ end=+'+ +syn region sqlString matchgroup=Quote start=+n\?q'\z([^[(<{]\)+ end=+\z1'+ +syn region sqlString matchgroup=Quote start=+n\?q'<+ end=+>'+ +syn region sqlString matchgroup=Quote start=+n\?q'{+ end=+}'+ +syn region sqlString matchgroup=Quote start=+n\?q'(+ end=+)'+ +syn region sqlString matchgroup=Quote start=+n\?q'\[+ end=+]'+ " Numbers: syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>" @@ -118,6 +129,7 @@ syn keyword sqlTodo TODO FIXME XXX DEBUG NOTE contained " Define the default highlighting. command -nargs=+ HiLink hi def link <args> +HiLink Quote Special HiLink sqlComment Comment HiLink sqlFunction Function HiLink sqlKeyword sqlSpecial diff --git a/runtime/syntax/sshconfig.vim b/runtime/syntax/sshconfig.vim index 479277e17f..302d073f1e 100644 --- a/runtime/syntax/sshconfig.vim +++ b/runtime/syntax/sshconfig.vim @@ -2,9 +2,11 @@ " Language: OpenSSH client configuration file (ssh_config) " Author: David Necas (Yeti) " Maintainer: Dominik Fischer <d dot f dot fischer at web dot de> -" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de> -" Last Change: 2015 Dec 3 -" SSH Version: 7.0 +" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de> +" Contributor: Karsten Hopp <karsten@redhat.com> +" Contributor: Dean, Adam Kenneth <adam.ken.dean@hpe.com> +" Last Change: 2016 Aug 11 +" SSH Version: 7.3p1 " " Setup @@ -35,30 +37,61 @@ syn keyword sshconfigTodo TODO FIXME NOTE contained " Constants -syn keyword sshconfigYesNo yes no ask +syn keyword sshconfigYesNo yes no ask confirm syn keyword sshconfigYesNo any auto syn keyword sshconfigYesNo force autoask none -syn keyword sshconfigCipher 3des blowfish -syn keyword sshconfigCiphers aes128-cbc 3des-cbc blowfish blowfish-cbc cast128-cbc -syn keyword sshconfigCiphers aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr -syn keyword sshconfigCiphers arcfour arcfour128 arcfour256 cast128-cbc +syn keyword sshconfigCipher 3des blowfish -syn keyword sshconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96 -syn keyword sshconfigMAC hmac-md5-96 -syn keyword sshconfigMAC hmac-sha2-256 hmac-sha2-256-96 hmac-sha2-512 -syn keyword sshconfigMAC hmac-sha2-512-96 +syn keyword sshconfigCiphers 3des-cbc +syn keyword sshconfigCiphers blowfish-cbc +syn keyword sshconfigCiphers cast128-cbc +syn keyword sshconfigCiphers arcfour +syn keyword sshconfigCiphers arcfour128 +syn keyword sshconfigCiphers arcfour256 +syn keyword sshconfigCiphers aes128-cbc +syn keyword sshconfigCiphers aes192-cbc +syn keyword sshconfigCiphers aes256-cbc +syn match sshconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>" +syn keyword sshconfigCiphers aes128-ctr +syn keyword sshconfigCiphers aes192-ctr +syn keyword sshconfigCiphers aes256-ctr +syn match sshconfigCiphers "\<aes128-gcm@openssh\.com\>" +syn match sshconfigCiphers "\<aes256-gcm@openssh\.com\>" +syn match sshconfigCiphers "\<chacha20-poly1305@openssh\.com\>" + +syn keyword sshconfigMAC hmac-sha1 +syn keyword sshconfigMAC mac-sha1-96 +syn keyword sshconfigMAC mac-sha2-256 +syn keyword sshconfigMAC mac-sha2-512 +syn keyword sshconfigMAC mac-md5 +syn keyword sshconfigMAC mac-md5-96 +syn keyword sshconfigMAC mac-ripemd160 +syn match sshconfigMAC "\<hmac-ripemd160@openssh\.com\>" syn match sshconfigMAC "\<umac-64@openssh\.com\>" +syn match sshconfigMAC "\<umac-128@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha1-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-md5-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-md5-96-etm@openssh\.com\>" +syn match sshconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>" +syn match sshconfigMAC "\<umac-64-etm@openssh\.com\>" +syn match sshconfigMAC "\<umac-128-etm@openssh\.com\>" -syn keyword sshconfigHostKeyAlg ssh-rsa ssh-dss -syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v01@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v00@openssh\.com\>" -syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v00@openssh\.com\>" -syn keyword sshconfigHostKeyAlg ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 +syn keyword sshconfigHostKeyAlgo ssh-ed25519 +syn match sshconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>" +syn keyword sshconfigHostKeyAlgo ssh-rsa +syn keyword sshconfigHostKeyAlgo ssh-dss +syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp256 +syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp384 +syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp521 +syn match sshconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>" +syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>" syn keyword sshconfigPreferredAuth hostbased publickey password gssapi-with-mic syn keyword sshconfigPreferredAuth keyboard-interactive @@ -69,19 +102,22 @@ syn keyword sshconfigSysLogFacility DAEMON USER AUTH AUTHPRIV LOCAL0 LOCAL1 syn keyword sshconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshconfigAddressFamily inet inet6 -syn match sshconfigIPQoS "af1[1234]" -syn match sshconfigIPQoS "af2[23]" +syn match sshconfigIPQoS "af1[123]" +syn match sshconfigIPQoS "af2[123]" syn match sshconfigIPQoS "af3[123]" syn match sshconfigIPQoS "af4[123]" syn match sshconfigIPQoS "cs[0-7]" syn keyword sshconfigIPQoS ef lowdelay throughput reliability syn keyword sshconfigKbdInteractive bsdauth pam skey -syn keyword sshconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 -syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256 -syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1 -syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1 -syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1 +syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256 +syn keyword sshconfigKexAlgo ecdh-sha2-nistp256 +syn keyword sshconfigKexAlgo ecdh-sha2-nistp384 +syn keyword sshconfigKexAlgo ecdh-sha2-nistp521 +syn match sshconfigKexAlgo "\<curve25519-sha256@libssh\.org\>" syn keyword sshconfigTunnel point-to-point ethernet @@ -104,8 +140,14 @@ syn keyword sshconfigHostSect Host syn keyword sshconfigMatch canonical exec host originalhost user localuser all syn keyword sshconfigKeyword AddressFamily +syn keyword sshconfigKeyword AddKeysToAgent syn keyword sshconfigKeyword BatchMode syn keyword sshconfigKeyword BindAddress +syn keyword sshconfigKeyword CanonicalDomains +syn keyword sshconfigKeyword CanonicalizeFallbackLocal +syn keyword sshconfigKeyword CanonicalizeHostname +syn keyword sshconfigKeyword CanonicalizeMaxDots +syn keyword sshconfigKeyword CertificateFile syn keyword sshconfigKeyword ChallengeResponseAuthentication syn keyword sshconfigKeyword CheckHostIP syn keyword sshconfigKeyword Cipher @@ -145,6 +187,8 @@ syn keyword sshconfigKeyword HostbasedKeyTypes syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword IdentitiesOnly syn keyword sshconfigKeyword IdentityFile +syn keyword sshconfigKeyword IgnoreUnknown +syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword KbdInteractiveAuthentication syn keyword sshconfigKeyword KbdInteractiveDevices syn keyword sshconfigKeyword KexAlgorithms @@ -162,6 +206,7 @@ syn keyword sshconfigKeyword Port syn keyword sshconfigKeyword PreferredAuthentications syn keyword sshconfigKeyword Protocol syn keyword sshconfigKeyword ProxyCommand +syn keyword sshconfigKeyword ProxyJump syn keyword sshconfigKeyword ProxyUseFDPass syn keyword sshconfigKeyword PubkeyAcceptedKeyTypes syn keyword sshconfigKeyword PubkeyAuthentication @@ -182,6 +227,7 @@ syn keyword sshconfigKeyword UseBlacklistedKeys syn keyword sshconfigKeyword UsePrivilegedPort syn keyword sshconfigKeyword User syn keyword sshconfigKeyword UserKnownHostsFile +syn keyword sshconfigKeyword UseRoaming syn keyword sshconfigKeyword VerifyHostKeyDNS syn keyword sshconfigKeyword VisualHostKey syn keyword sshconfigKeyword XAuthLocation @@ -204,7 +250,7 @@ if version >= 508 || !exists("did_sshconfig_syntax_inits") HiLink sshconfigCipher sshconfigEnum HiLink sshconfigCiphers sshconfigEnum HiLink sshconfigMAC sshconfigEnum - HiLink sshconfigHostKeyAlg sshconfigEnum + HiLink sshconfigHostKeyAlgo sshconfigEnum HiLink sshconfigLogLevel sshconfigEnum HiLink sshconfigSysLogFacility sshconfigEnum HiLink sshconfigAddressFamily sshconfigEnum diff --git a/runtime/syntax/sshdconfig.vim b/runtime/syntax/sshdconfig.vim index ac90a80aa5..6b7b98d893 100644 --- a/runtime/syntax/sshdconfig.vim +++ b/runtime/syntax/sshdconfig.vim @@ -4,9 +4,10 @@ " Maintainer: Dominik Fischer <d dot f dot fischer at web dot de> " Contributor: Thilo Six " Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de> +" Contributor: Karsten Hopp <karsten@redhat.com> " Originally: 2009-07-09 -" Last Change: 2015 Dec 3 -" SSH Version: 7.0 +" Last Change: 2016 Mar 1 +" SSH Version: 7.2 " " Setup @@ -46,15 +47,55 @@ syn keyword sshdconfigTcpForwarding local remote syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only -syn keyword sshdconfigCipher aes128-cbc 3des-cbc blowfish-cbc cast128-cbc -syn keyword sshdconfigCipher aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr -syn keyword sshdconfigCipher arcfour arcfour128 arcfour256 cast128-cbc - -syn keyword sshdconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96 -syn keyword sshdconfigMAC hmac-md5-96 -syn keyword sshdconfigMAC hmac-sha2-256 hmac-sha256-96 hmac-sha2-512 -syn keyword sshdconfigMAC hmac-sha2-512-96 +syn keyword sshdconfigCiphers 3des-cbc +syn keyword sshdconfigCiphers blowfish-cbc +syn keyword sshdconfigCiphers cast128-cbc +syn keyword sshdconfigCiphers arcfour +syn keyword sshdconfigCiphers arcfour128 +syn keyword sshdconfigCiphers arcfour256 +syn keyword sshdconfigCiphers aes128-cbc +syn keyword sshdconfigCiphers aes192-cbc +syn keyword sshdconfigCiphers aes256-cbc +syn match sshdconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>" +syn keyword sshdconfigCiphers aes128-ctr +syn keyword sshdconfigCiphers aes192-ctr +syn keyword sshdconfigCiphers aes256-ctr +syn match sshdconfigCiphers "\<aes128-gcm@openssh\.com\>" +syn match sshdconfigCiphers "\<aes256-gcm@openssh\.com\>" +syn match sshdconfigCiphers "\<chacha20-poly1305@openssh\.com\>" + +syn keyword sshdconfigMAC hmac-sha1 +syn keyword sshdconfigMAC mac-sha1-96 +syn keyword sshdconfigMAC mac-sha2-256 +syn keyword sshdconfigMAC mac-sha2-512 +syn keyword sshdconfigMAC mac-md5 +syn keyword sshdconfigMAC mac-md5-96 +syn keyword sshdconfigMAC mac-ripemd160 +syn match sshdconfigMAC "\<hmac-ripemd160@openssh\.com\>" syn match sshdconfigMAC "\<umac-64@openssh\.com\>" +syn match sshdconfigMAC "\<umac-128@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha1-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-md5-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-md5-96-etm@openssh\.com\>" +syn match sshdconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>" +syn match sshdconfigMAC "\<umac-64-etm@openssh\.com\>" +syn match sshdconfigMAC "\<umac-128-etm@openssh\.com\>" + +syn keyword sshdconfigHostKeyAlgo ssh-ed25519 +syn match sshdconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>" +syn keyword sshdconfigHostKeyAlgo ssh-rsa +syn keyword sshdconfigHostKeyAlgo ssh-dss +syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp256 +syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp384 +syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp521 +syn match sshdconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>" +syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>" syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only @@ -65,18 +106,21 @@ syn keyword sshdconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshdconfigCompression delayed -syn match sshdconfigIPQoS "af1[1234]" -syn match sshdconfigIPQoS "af2[23]" +syn match sshdconfigIPQoS "af1[123]" +syn match sshdconfigIPQoS "af2[123]" syn match sshdconfigIPQoS "af3[123]" syn match sshdconfigIPQoS "af4[123]" syn match sshdconfigIPQoS "cs[0-7]" syn keyword sshdconfigIPQoS ef lowdelay throughput reliability -syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 -syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256 -syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1 -syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1 -syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1 +syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256 +syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256 +syn keyword sshdconfigKexAlgo ecdh-sha2-nistp384 +syn keyword sshdconfigKexAlgo ecdh-sha2-nistp521 +syn match sshdconfigKexAlgo "\<curve25519-sha256@libssh\.org\>" syn keyword sshdconfigTunnel point-to-point ethernet @@ -109,6 +153,7 @@ syn keyword sshdconfigKeyword AllowGroups syn keyword sshdconfigKeyword AllowStreamLocalForwarding syn keyword sshdconfigKeyword AllowTcpForwarding syn keyword sshdconfigKeyword AllowUsers +syn keyword sshdconfigKeyword AuthenticationMethods syn keyword sshdconfigKeyword AuthorizedKeysFile syn keyword sshdconfigKeyword AuthorizedKeysCommand syn keyword sshdconfigKeyword AuthorizedKeysCommandUser @@ -132,6 +177,7 @@ syn keyword sshdconfigKeyword GSSAPIStrictAcceptorCheck syn keyword sshdconfigKeyword GatewayPorts syn keyword sshdconfigKeyword HostCertificate syn keyword sshdconfigKeyword HostKey +syn keyword sshdconfigKeyword HostKeyAgent syn keyword sshdconfigKeyword HostKeyAlgorithms syn keyword sshdconfigKeyword HostbasedAcceptedKeyTypes syn keyword sshdconfigKeyword HostbasedAuthentication @@ -212,8 +258,9 @@ if version >= 508 || !exists("did_sshdconfig_syntax_inits") HiLink sshdconfigPrivilegeSeparation sshdconfigEnum HiLink sshdconfigTcpForwarding sshdconfigEnum HiLink sshdconfigRootLogin sshdconfigEnum - HiLink sshdconfigCipher sshdconfigEnum + HiLink sshdconfigCiphers sshdconfigEnum HiLink sshdconfigMAC sshdconfigEnum + HiLink sshdconfigHostKeyAlgo sshdconfigEnum HiLink sshdconfigRootLogin sshdconfigEnum HiLink sshdconfigLogLevel sshdconfigEnum HiLink sshdconfigSysLogFacility sshdconfigEnum diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index d31e14bed0..e560573e6e 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: Oct 20, 2015 -" Version: 90 +" Last Change: Jun 17, 2016 +" Version: 97 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -83,10 +83,14 @@ else let s:tex_conceal= g:tex_conceal endif if !exists("g:tex_superscripts") - let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]" + let s:tex_superscripts= '[0-9a-zA-W.,:;+-<>/()=]' +else + let s:tex_superscripts= g:tex_superscripts endif if !exists("g:tex_subscripts") - let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]" + let s:tex_subscripts= '[0-9aehijklmnoprstuvx,+-/().]' +else + let s:tex_subscripts= g:tex_subscripts endif " Determine whether or not to use "*.sty" mode {{{1 @@ -129,8 +133,10 @@ endif " g:tex_isk if exists("g:tex_isk") exe "setlocal isk=".g:tex_isk +elseif !has("patch-7.4.1142") + setl isk=48-57,a-z,A-Z,192-255 else - setlocal isk=48-57,a-z,A-Z,192-255 + syn iskeyword 48-57,a-z,A-Z,192-255 endif if b:tex_stylish setlocal isk+=@-@ @@ -198,24 +204,24 @@ if !exists("g:tex_no_math") endif " Try to flag {} and () mismatches: {{{1 -if s:tex_fast =~ 'm' +if s:tex_fast =~# 'm' if !s:tex_no_error - syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError - syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell + syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError + syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell else - syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup - syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup + syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup + syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup endif if !s:tex_nospell - syn region texParen start="(" end=")" transparent contains=@texMatchGroup,@Spell + syn region texParen start="(" end=")" transparent contains=@texMatchGroup,@Spell else - syn region texParen start="(" end=")" transparent contains=@texMatchGroup + syn region texParen start="(" end=")" transparent contains=@texMatchGroup endif endif if !s:tex_no_error syn match texError "[}\])]" endif -if s:tex_fast =~ 'M' +if s:tex_fast =~# 'M' if !exists("g:tex_no_math") if !s:tex_no_error syn match texMathError "}" contained @@ -258,14 +264,14 @@ syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" " \begin{}/\end{} section markers: {{{1 syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName -if s:tex_fast =~ 'm' +if s:tex_fast =~# 'm' syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment - syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell + syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@texMathZones,@NoSpell endif " \documentclass, \documentstyle, \usepackage: {{{1 syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs -if s:tex_fast =~ 'm' +if s:tex_fast =~# 'm' syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell endif @@ -279,7 +285,7 @@ syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatemen syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt syn match texInputCurlies "[{}]" contained -if s:tex_fast =~ 'm' +if s:tex_fast =~# 'm' syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment endif @@ -294,7 +300,7 @@ syn match texTypeStyle "\\sc\>" syn match texTypeStyle "\\tt\>" " Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1 -if s:tex_conceal !~ 'b' +if s:tex_conceal !~# 'b' syn match texTypeStyle "\\textbf\>" syn match texTypeStyle "\\textit\>" endif @@ -347,7 +353,7 @@ syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup= syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained " Sections, subsections, etc: {{{1 -if s:tex_fast =~ 'p' +if s:tex_fast =~# 'p' if !s:tex_nospell TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell @@ -374,8 +380,8 @@ if s:tex_fast =~ 'p' endif " particular support for bold and italic {{{1 -if s:tex_fast =~ 'b' - if s:tex_conceal =~ 'b' +if s:tex_fast =~# 'b' + if s:tex_conceal =~# 'b' if !exists("g:tex_nospell") || !g:tex_nospell syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell @@ -412,7 +418,7 @@ if !exists("g:tex_no_math") let foldcmd= "" endif exe "syn cluster texMathZones add=".grpname - if s:tex_fast =~ 'M' + if s:tex_fast =~# 'M' exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' @@ -422,7 +428,7 @@ if !exists("g:tex_no_math") let grpname = "texMathZone".a:sfx.'S' let syncname = "texSyncMathZone".a:sfx.'S' exe "syn cluster texMathZones add=".grpname - if s:tex_fast =~ 'M' + if s:tex_fast =~# 'M' exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' @@ -446,8 +452,8 @@ if !exists("g:tex_no_math") call TexNewMathZone("L","xxalignat",0) " Inline Math Zones: {{{2 - if s:tex_fast =~ 'M' - if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd' + if s:tex_fast =~# 'M' + if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~# 'd' syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup @@ -464,7 +470,7 @@ if !exists("g:tex_no_math") syn match texMathOper "[_^=]" contained " Text Inside Math Zones: {{{2 - if s:tex_fast =~ 'M' + if s:tex_fast =~# 'M' if !exists("g:tex_nospell") || !g:tex_nospell syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell else @@ -474,7 +480,7 @@ if !exists("g:tex_no_math") " \left..something.. and \right..something.. support: {{{2 syn match texMathDelimBad contained "\S" - if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm' + if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~# 'm' syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={ syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=} let s:texMathDelimList=[ @@ -539,7 +545,7 @@ if !exists("g:tex_no_math") syn match texOnlyMath "[_^]" endif syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S" -if s:tex_conceal !~ 'S' +if s:tex_conceal !~# 'S' syn match texSpecialChar '\\glq\>' contained conceal cchar=‚ syn match texSpecialChar '\\grq\>' contained conceal cchar=‘ syn match texSpecialChar '\\glqq\>' contained conceal cchar=„ @@ -566,13 +572,13 @@ else " allows syntax-folding of 2 or more contiguous comment lines " single-line comments are not folded syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' + if s:tex_fast =~# 'c' TexFold syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' contains=@texCommentGroup TexFold syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell endif else syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' + if s:tex_fast =~# 'c' syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell endif endif @@ -581,7 +587,7 @@ endif " Separate lines used for verb` and verb# so that the end conditions {{{1 " will appropriately terminate. " If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there. -if s:tex_fast =~ 'v' +if s:tex_fast =~# 'v' if exists("g:tex_verbspell") && g:tex_verbspell syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell " listings package: @@ -612,7 +618,7 @@ if s:tex_fast =~ 'v' endif " Tex Reference Zones: {{{1 -if s:tex_fast =~ 'r' +if s:tex_fast =~# 'r' syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup @@ -626,13 +632,13 @@ syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite " Handle newcommand, newenvironment : {{{1 syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl -if s:tex_fast =~ 'V' +if s:tex_fast =~# 'V' syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup endif syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl -if s:tex_fast =~ 'V' +if s:tex_fast =~# 'V' syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup @@ -658,11 +664,11 @@ syn match texString "\(``\|''\|,,\)" " makeatletter -- makeatother sections if !s:tex_no_error - if s:tex_fast =~ 'S' + if s:tex_fast =~# 'S' syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained endif syn match texStyleStatement "\\[a-zA-Z@]\+" contained - if s:tex_fast =~ 'S' + if s:tex_fast =~# 'S' syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained endif @@ -673,7 +679,7 @@ if has("conceal") && &enc == 'utf-8' " Math Symbols {{{2 " (many of these symbols were contributed by Björn Winckler) - if s:tex_conceal =~ 'm' + if s:tex_conceal =~# 'm' let s:texMathList=[ \ ['|' , '‖'], \ ['aleph' , 'ℵ'], @@ -954,7 +960,7 @@ if has("conceal") && &enc == 'utf-8' " \ ['uminus' , 'X'] " \ ['uplus' , 'X'] for texmath in s:texMathList - if texmath[0] =~ '\w$' + if texmath[0] =~# '\w$' exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1] else exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1] @@ -993,7 +999,7 @@ if has("conceal") && &enc == 'utf-8' endif " Greek {{{2 - if s:tex_conceal =~ 'g' + if s:tex_conceal =~# 'g' fun! s:Greek(group,pat,cchar) exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar endfun @@ -1040,14 +1046,14 @@ if has("conceal") && &enc == 'utf-8' endif " Superscripts/Subscripts {{{2 - if s:tex_conceal =~ 's' - if s:tex_fast =~ 's' + if s:tex_conceal =~# 's' + if s:tex_fast =~# 's' syn region texSuperscript matchgroup=Delimiter start='\^{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher endif " s:SuperSub: fun! s:SuperSub(group,leader,pat,cchar) - if a:pat =~ '^\\' || (a:leader == '\^' && a:pat =~ g:tex_superscripts) || (a:leader == '_' && a:pat =~ g:tex_subscripts) + if a:pat =~# '^\\' || (a:leader == '\^' && a:pat =~# s:tex_superscripts) || (a:leader == '_' && a:pat =~# s:tex_subscripts) " call Decho("SuperSub: group<".a:group."> leader<".a:leader."> pat<".a:pat."> cchar<".a:cchar.">") exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar exe 'syn match '.a:group."s '".a:pat ."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s' @@ -1130,9 +1136,21 @@ if has("conceal") && &enc == 'utf-8' call s:SuperSub('texSubscript','_','9','₉') call s:SuperSub('texSubscript','_','a','â‚') call s:SuperSub('texSubscript','_','e','â‚‘') + call s:SuperSub('texSubscript','_','h','â‚•') call s:SuperSub('texSubscript','_','i','áµ¢') + call s:SuperSub('texSubscript','_','j','â±¼') + call s:SuperSub('texSubscript','_','k','â‚–') + call s:SuperSub('texSubscript','_','l','â‚—') + call s:SuperSub('texSubscript','_','m','ₘ') + call s:SuperSub('texSubscript','_','n','â‚™') call s:SuperSub('texSubscript','_','o','â‚’') + call s:SuperSub('texSubscript','_','p','ₚ') + call s:SuperSub('texSubscript','_','r','áµ£') + call s:SuperSub('texSubscript','_','s','â‚›') + call s:SuperSub('texSubscript','_','t','ₜ') call s:SuperSub('texSubscript','_','u','ᵤ') + call s:SuperSub('texSubscript','_','v','áµ¥') + call s:SuperSub('texSubscript','_','x','â‚“') call s:SuperSub('texSubscript','_',',','ï¸') call s:SuperSub('texSubscript','_','+','₊') call s:SuperSub('texSubscript','_','-','â‚‹') @@ -1148,11 +1166,12 @@ if has("conceal") && &enc == 'utf-8' call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ') call s:SuperSub('texSubscript','_','\\gamma\>','áµ§') call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ') + delfun s:SuperSub endif " Accented characters: {{{2 - if s:tex_conceal =~ 'a' + if s:tex_conceal =~# 'a' if b:tex_stylish syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 @@ -1167,7 +1186,7 @@ if has("conceal") && &enc == 'utf-8' let i= i + 1 continue endif - if accent =~ '\a' + if accent =~# '\a' exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i} else exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i} diff --git a/runtime/syntax/tidy.vim b/runtime/syntax/tidy.vim index c24796edd1..6371cb5a86 100644 --- a/runtime/syntax/tidy.vim +++ b/runtime/syntax/tidy.vim @@ -1,145 +1,135 @@ " Vim syntax file " Language: HMTL Tidy configuration file (/etc/tidyrc ~/.tidyrc) " Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2013 June 01 +" Last Change: 2016 Apr 24 if exists("b:current_syntax") finish endif -setlocal iskeyword=@,48-57,- +let s:cpo_save = &cpo +set cpo&vim + +syn iskeyword @,48-57,-,_ + +syn case ignore +syn keyword tidyBoolean contained t[rue] f[alse] y[es] n[o] 1 0 +syn keyword tidyAutoBoolean contained t[rue] f[alse] y[es] n[o] 1 0 auto +syn case match +syn keyword tidyDoctype contained html5 omit auto strict loose transitional user +syn keyword tidyEncoding contained raw ascii latin0 latin1 utf8 iso2022 mac win1252 ibm858 utf16le utf16be utf16 big5 shiftjis +syn keyword tidyNewline contained LF CRLF CR +syn match tidyNumber contained "\<\d\+\>" +syn keyword tidyRepeat contained keep-first keep-last +syn keyword tidySorter contained alpha none +syn region tidyString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline +syn region tidyString contained start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline +syn match tidyTags contained "\<\w\+\(\s*,\s*\w\+\)*\>" + +syn keyword tidyBooleanOption add-xml-decl add-xml-pi add-xml-space + \ anchor-as-name ascii-chars assume-xml-procins bare break-before-br + \ clean coerce-endtags decorate-inferred-ul drop-empty-paras + \ drop-empty-elements drop-font-tags drop-proprietary-attributes + \ enclose-block-text enclose-text escape-cdata escape-scripts + \ fix-backslash fix-bad-comments fix-uri force-output gdoc gnu-emacs + \ hide-comments hide-endtags indent-attributes indent-cdata + \ indent-with-tabs input-xml join-classes join-styles keep-time + \ language literal-attributes logical-emphasis lower-literals markup + \ merge-emphasis ncr numeric-entities omit-optional-tags output-html + \ output-xhtml output-xml preserve-entities punctuation-wrap quiet + \ quote-ampersand quote-marks quote-nbsp raw replace-color show-info + \ show-warnings skip-nested split strict-tags-attributes tidy-mark + \ uppercase-attributes uppercase-tags word-2000 wrap-asp + \ wrap-attributes wrap-jste wrap-php wrap-script-literals + \ wrap-sections write-back + \ contained nextgroup=tidyBooleanDelimiter + +syn match tidyBooleanDelimiter ":" nextgroup=tidyBoolean contained skipwhite + +syn keyword tidyAutoBooleanOption indent merge-divs merge-spans output-bom show-body-only vertical-space contained nextgroup=tidyAutoBooleanDelimiter +syn match tidyAutoBooleanDelimiter ":" nextgroup=tidyAutoBoolean contained skipwhite + +syn keyword tidyCSSSelectorOption css-prefix contained nextgroup=tidyCSSSelectorDelimiter +syn match tidyCSSSelectorDelimiter ":" nextgroup=tidyCSSSelector contained skipwhite + +syn keyword tidyDoctypeOption doctype contained nextgroup=tidyDoctypeDelimiter +syn match tidyDoctypeDelimiter ":" nextgroup=tidyDoctype contained skipwhite + +syn keyword tidyEncodingOption char-encoding input-encoding output-encoding contained nextgroup=tidyEncodingDelimiter +syn match tidyEncodingDelimiter ":" nextgroup=tidyEncoding contained skipwhite + +syn keyword tidyIntegerOption accessibility-check doctype-mode indent-spaces show-errors tab-size wrap contained nextgroup=tidyIntegerDelimiter +syn match tidyIntegerDelimiter ":" nextgroup=tidyNumber contained skipwhite + +syn keyword tidyNameOption slide-style contained nextgroup=tidyNameDelimiter +syn match tidyNameDelimiter ":" nextgroup=tidyName contained skipwhite + +syn keyword tidyNewlineOption newline contained nextgroup=tidyNewlineDelimiter +syn match tidyNewlineDelimiter ":" nextgroup=tidyNewline contained skipwhite + +syn keyword tidyTagsOption new-blocklevel-tags new-empty-tags new-inline-tags new-pre-tags contained nextgroup=tidyTagsDelimiter +syn match tidyTagsDelimiter ":" nextgroup=tidyTags contained skipwhite + +syn keyword tidyRepeatOption repeated-attributes contained nextgroup=tidyRepeatDelimiter +syn match tidyRepeatDelimiter ":" nextgroup=tidyRepeat contained skipwhite + +syn keyword tidySorterOption sort-attributes contained nextgroup=tidySorterDelimiter +syn match tidySorterDelimiter ":" nextgroup=tidySorter contained skipwhite + +syn keyword tidyStringOption alt-text error-file gnu-emacs-file output-file contained nextgroup=tidyStringDelimiter +syn match tidyStringDelimiter ":" nextgroup=tidyString contained skipwhite + +syn cluster tidyOptions contains=tidy.*Option + +syn match tidyStart "^" nextgroup=@tidyOptions syn match tidyComment "^\s*//.*$" contains=tidyTodo syn match tidyComment "^\s*#.*$" contains=tidyTodo syn keyword tidyTodo TODO NOTE FIXME XXX contained -syn match tidyAssignment "^[a-z0-9-]\+:\s*.*$" contains=tidyOption,@tidyValue,tidyDelimiter -syn match tidyDelimiter ":" contained +hi def link tidyAutoBooleanOption Identifier +hi def link tidyBooleanOption Identifier +hi def link tidyCSSSelectorOption Identifier +hi def link tidyDoctypeOption Identifier +hi def link tidyEncodingOption Identifier +hi def link tidyIntegerOption Identifier +hi def link tidyNameOption Identifier +hi def link tidyNewlineOption Identifier +hi def link tidyTagsOption Identifier +hi def link tidyRepeatOption Identifier +hi def link tidySorterOption Identifier +hi def link tidyStringOption Identifier -syn match tidyNewTagAssignment "^new-\l\+-tags:\s*.*$" contains=tidyNewTagOption,tidyNewTagDelimiter,tidyNewTagValue,tidyDelimiter -syn match tidyNewTagDelimiter "," contained -syn match tidyNewTagValue "\<\w\+\>" contained +hi def link tidyAutoBooleanDelimiter Special +hi def link tidyBooleanDelimiter Special +hi def link tidyCSSSelectorDelimiter Special +hi def link tidyDoctypeDelimiter Special +hi def link tidyEncodingDelimiter Special +hi def link tidyIntegerDelimiter Special +hi def link tidyNameDelimiter Special +hi def link tidyNewlineDelimiter Special +hi def link tidyTagsDelimiter Special +hi def link tidyRepeatDelimiter Special +hi def link tidySorterDelimiter Special +hi def link tidyStringDelimiter Special -syn case ignore -syn keyword tidyBoolean t[rue] f[alse] y[es] n[o] contained -syn case match -syn match tidyDoctype "\<\%(omit\|auto\|strict\|loose\|transitional\|user\)\>" contained -" NOTE: use match rather than keyword here so that tidyEncoding 'raw' does not -" always have precedence over tidyOption 'raw' -syn match tidyEncoding "\<\%(ascii\|latin0\|latin1\|raw\|utf8\|iso2022\|mac\|utf16le\|utf16be\|utf16\|win1252\|ibm858\|big5\|shiftjis\)\>" contained -syn match tidyNewline "\<\%(LF\|CRLF\|CR\)\>" -syn match tidyNumber "\<\d\+\>" contained -syn match tidyRepeat "\<\%(keep-first\|keep-last\)\>" contained -syn region tidyString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained oneline -syn region tidyString start=+'+ skip=+\\\\\|\\'+ end=+'+ contained oneline -syn cluster tidyValue contains=tidyBoolean,tidyDoctype,tidyEncoding,tidyNewline,tidyNumber,tidyRepeat,tidyString - -syn match tidyOption "^accessibility-check" contained -syn match tidyOption "^add-xml-decl" contained -syn match tidyOption "^add-xml-pi" contained -syn match tidyOption "^add-xml-space" contained -syn match tidyOption "^alt-text" contained -syn match tidyOption "^anchor-as-name" contained -syn match tidyOption "^ascii-chars" contained -syn match tidyOption "^assume-xml-procins" contained -syn match tidyOption "^bare" contained -syn match tidyOption "^break-before-br" contained -syn match tidyOption "^char-encoding" contained -syn match tidyOption "^clean" contained -syn match tidyOption "^css-prefix" contained -syn match tidyOption "^decorate-inferred-ul" contained -syn match tidyOption "^doctype" contained -syn match tidyOption "^doctype-mode" contained -syn match tidyOption "^drop-empty-paras" contained -syn match tidyOption "^drop-font-tags" contained -syn match tidyOption "^drop-proprietary-attributes" contained -syn match tidyOption "^enclose-block-text" contained -syn match tidyOption "^enclose-text" contained -syn match tidyOption "^error-file" contained -syn match tidyOption "^escape-cdata" contained -syn match tidyOption "^fix-backslash" contained -syn match tidyOption "^fix-bad-comments" contained -syn match tidyOption "^fix-uri" contained -syn match tidyOption "^force-output" contained -syn match tidyOption "^gnu-emacs" contained -syn match tidyOption "^gnu-emacs-file" contained -syn match tidyOption "^hide-comments" contained -syn match tidyOption "^hide-endtags" contained -syn match tidyOption "^indent" contained -syn match tidyOption "^indent-attributes" contained -syn match tidyOption "^indent-cdata" contained -syn match tidyOption "^indent-spaces" contained -syn match tidyOption "^input-encoding" contained -syn match tidyOption "^input-xml" contained -syn match tidyOption "^join-classes" contained -syn match tidyOption "^join-styles" contained -syn match tidyOption "^keep-time" contained -syn match tidyOption "^language" contained -syn match tidyOption "^literal-attributes" contained -syn match tidyOption "^logical-emphasis" contained -syn match tidyOption "^lower-literals" contained -syn match tidyOption "^markup" contained -syn match tidyOption "^merge-divs" contained -syn match tidyOption "^merge-spans" contained -syn match tidyOption "^ncr" contained -syn match tidyOption "^newline" contained -syn match tidyOption "^numeric-entities" contained -syn match tidyOption "^output-bom" contained -syn match tidyOption "^output-encoding" contained -syn match tidyOption "^output-file" contained -syn match tidyOption "^output-html" contained -syn match tidyOption "^output-xhtml" contained -syn match tidyOption "^output-xml" contained -syn match tidyOption "^preserve-entities" contained -syn match tidyOption "^punctuation-wrap" contained -syn match tidyOption "^quiet" contained -syn match tidyOption "^quote-ampersand" contained -syn match tidyOption "^quote-marks" contained -syn match tidyOption "^quote-nbsp" contained -syn match tidyOption "^raw" contained -syn match tidyOption "^repeated-attributes" contained -syn match tidyOption "^replace-color" contained -syn match tidyOption "^show-body-only" contained -syn match tidyOption "^show-errors" contained -syn match tidyOption "^show-warnings" contained -syn match tidyOption "^slide-style" contained -syn match tidyOption "^sort-attributes" contained -syn match tidyOption "^split" contained -syn match tidyOption "^tab-size" contained -syn match tidyOption "^tidy-mark" contained -syn match tidyOption "^uppercase-attributes" contained -syn match tidyOption "^uppercase-tags" contained -syn match tidyOption "^word-2000" contained -syn match tidyOption "^wrap" contained -syn match tidyOption "^wrap-asp" contained -syn match tidyOption "^wrap-attributes" contained -syn match tidyOption "^wrap-jste" contained -syn match tidyOption "^wrap-php" contained -syn match tidyOption "^wrap-script-literals" contained -syn match tidyOption "^wrap-sections" contained -syn match tidyOption "^write-back" contained -syn match tidyOption "^vertical-space" contained - -syn match tidyNewTagOption "^new-blocklevel-tags" contained -syn match tidyNewTagOption "^new-empty-tags" contained -syn match tidyNewTagOption "^new-inline-tags" contained -syn match tidyNewTagOption "^new-pre-tags" contained - -hi def link tidyBoolean Boolean -hi def link tidyComment Comment -hi def link tidyDelimiter Special -hi def link tidyDoctype Constant -hi def link tidyEncoding Constant -hi def link tidyNewline Constant -hi def link tidyNewTagDelimiter Special -hi def link tidyNewTagOption Identifier -hi def link tidyNewTagValue Constant -hi def link tidyNumber Number -hi def link tidyOption Identifier -hi def link tidyRepeat Constant -hi def link tidyString String -hi def link tidyTodo Todo +hi def link tidyAutoBoolean Boolean +hi def link tidyBoolean Boolean +hi def link tidyDoctype Constant +hi def link tidyEncoding Constant +hi def link tidyNewline Constant +hi def link tidyTags Constant +hi def link tidyNumber Number +hi def link tidyRepeat Constant +hi def link tidySorter Constant +hi def link tidyString String + +hi def link tidyComment Comment +hi def link tidyTodo Todo let b:current_syntax = "tidy" +let &cpo = s:cpo_save +unlet s:cpo_save + " vim: ts=8 diff --git a/runtime/syntax/vhdl.vim b/runtime/syntax/vhdl.vim index 916bd9635d..32503823ee 100644 --- a/runtime/syntax/vhdl.vim +++ b/runtime/syntax/vhdl.vim @@ -1,14 +1,10 @@ " Vim syntax file -" Language: VHDL -" Maintainer: Daniel Kho <daniel.kho@tauhop.com> +" Language: VHDL [VHSIC (Very High Speed Integrated Circuit) Hardware Description Language] +" Maintainer: Daniel Kho <daniel.kho@tauhop.com> " Previous Maintainer: Czo <Olivier.Sirol@lip6.fr> -" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn> -" Last Changed: 2015 Dec 4 by Daniel Kho +" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn> +" Last Changed: 2016 Mar 05 by Daniel Kho -" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") @@ -56,17 +52,40 @@ syn keyword vhdlStatement note warning error failure syn match vhdlStatement "\<\(if\|else\)\>" syn match vhdlError "\<else\s\+if\>" -" Predefined VHDL types -syn keyword vhdlType bit bit_vector -syn keyword vhdlType character boolean integer real time -syn keyword vhdlType boolean_vector integer_vector real_vector time_vector -syn keyword vhdlType string severity_level -" Predefined standard ieee VHDL types -syn keyword vhdlType positive natural signed unsigned -syn keyword vhdlType unresolved_signed unresolved_unsigned u_signed u_unsigned -syn keyword vhdlType line text -syn keyword vhdlType std_logic std_logic_vector -syn keyword vhdlType std_ulogic std_ulogic_vector +" Types and type qualifiers +" Predefined standard VHDL types +syn match vhdlType "\<bit\>\'\=" +syn match vhdlType "\<boolean\>\'\=" +syn match vhdlType "\<natural\>\'\=" +syn match vhdlType "\<positive\>\'\=" +syn match vhdlType "\<integer\>\'\=" +syn match vhdlType "\<real\>\'\=" +syn match vhdlType "\<time\>\'\=" + +syn match vhdlType "\<bit_vector\>\'\=" +syn match vhdlType "\<boolean_vector\>\'\=" +syn match vhdlType "\<integer_vector\>\'\=" +syn match vhdlType "\<real_vector\>\'\=" +syn match vhdlType "\<time_vector\>\'\=" + +syn match vhdlType "\<character\>\'\=" +syn match vhdlType "\<string\>\'\=" +"syn keyword vhdlType severity_level +syn keyword vhdlType line +syn keyword vhdlType text + +" Predefined standard IEEE VHDL types +syn match vhdlType "\<std_ulogic\>\'\=" +syn match vhdlType "\<std_logic\>\'\=" +syn match vhdlType "\<std_ulogic_vector\>\'\=" +syn match vhdlType "\<std_logic_vector\>\'\=" +syn match vhdlType "\<unresolved_signed\>\'\=" +syn match vhdlType "\<unresolved_unsigned\>\'\=" +syn match vhdlType "\<u_signed\>\'\=" +syn match vhdlType "\<u_unsigned\>\'\=" +syn match vhdlType "\<signed\>\'\=" +syn match vhdlType "\<unsigned\>\'\=" + " array attributes syn match vhdlAttribute "\'high" @@ -191,15 +210,23 @@ syn case ignore syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell syn match vhdlComment "\(^\|\s\)--.*" contains=vhdlTodo,vhdlFixme,@Spell +" Standard IEEE P1076.6 preprocessor directives (metacomments). +syn match vhdlPreProc "/\*\s*rtl_synthesis\s\+\(on\|off\)\s*\*/" +syn match vhdlPreProc "\(^\|\s\)--\s*rtl_synthesis\s\+\(on\|off\)\s*" +syn match vhdlPreProc "/\*\s*rtl_syn\s\+\(on\|off\)\s*\*/" +syn match vhdlPreProc "\(^\|\s\)--\s*rtl_syn\s\+\(on\|off\)\s*" + " Industry-standard directives. These are not standard VHDL, but are commonly " used in the industry. syn match vhdlPreProc "/\*\s*synthesis\s\+translate_\(on\|off\)\s*\*/" "syn match vhdlPreProc "/\*\s*simulation\s\+translate_\(on\|off\)\s*\*/" +syn match vhdlPreProc "/\*\s*pragma\s\+translate_\(on\|off\)\s*\*/" syn match vhdlPreProc "/\*\s*pragma\s\+synthesis_\(on\|off\)\s*\*/" syn match vhdlPreProc "/\*\s*synopsys\s\+translate_\(on\|off\)\s*\*/" syn match vhdlPreProc "\(^\|\s\)--\s*synthesis\s\+translate_\(on\|off\)\s*" "syn match vhdlPreProc "\(^\|\s\)--\s*simulation\s\+translate_\(on\|off\)\s*" +syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+translate_\(on\|off\)\s*" syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+synthesis_\(on\|off\)\s*" syn match vhdlPreProc "\(^\|\s\)--\s*synopsys\s\+translate_\(on\|off\)\s*" @@ -216,24 +243,24 @@ if version >= 508 || !exists("did_vhdl_syntax_inits") else command -nargs=+ HiLink hi def link <args> endif - - HiLink vhdlSpecial Special - HiLink vhdlStatement Statement - HiLink vhdlCharacter Character - HiLink vhdlString String - HiLink vhdlVector Number - HiLink vhdlBoolean Number - HiLink vhdlTodo Todo - HiLink vhdlFixme Fixme - HiLink vhdlComment Comment - HiLink vhdlNumber Number - HiLink vhdlTime Number - HiLink vhdlType Type - HiLink vhdlOperator Operator - HiLink vhdlError Error - HiLink vhdlAttribute Special - HiLink vhdlPreProc PreProc - + + HiLink vhdlSpecial Special + HiLink vhdlStatement Statement + HiLink vhdlCharacter Character + HiLink vhdlString String + HiLink vhdlVector Number + HiLink vhdlBoolean Number + HiLink vhdlTodo Todo + HiLink vhdlFixme Fixme + HiLink vhdlComment Comment + HiLink vhdlNumber Number + HiLink vhdlTime Number + HiLink vhdlType Type + HiLink vhdlOperator Operator + HiLink vhdlError Error + HiLink vhdlAttribute Special + HiLink vhdlPreProc PreProc + delcommand HiLink endif diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index cf51830b68..63618e902e 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,9 +1,12 @@ " Vim syntax file -" Language: Vim 7.4 script -" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Apr 02, 2015 -" Version: 7.4-33 -" Automatically generated keyword lists: {{{1 + +" ############################################################################# +" ############################################################################# +" Note: Be careful when merging the upstream version of this file. +" Much of this is generated by scripts/genvimvim.lua (result is installed +" to: $VIMRUNTIME/syntax/vim/generated.vim) +" ############################################################################# +" ############################################################################# " Quit when a syntax file was already loaded {{{2 if exists("b:current_syntax") @@ -31,8 +34,8 @@ syn keyword vimOnlyOption contained nobiosk nobioskey noconsk noconskey nocp noc " Invertible setting variants syn keyword vimOnlyOption contained invbiosk invbioskey invconsk invconskey invcp invcompatible invguipty invmacatsui invsn invshortname invta invtextauto invtx invtextmode invtf invttyfast invtbi invttybuiltin invwiv invweirdinvert " termcap codes (which can also be set) {{{2 -syn keyword vimTermOption contained t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CS t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR -syn keyword vimTermOption contained t_AF t_AL t_cd t_Ce t_cm t_cs +syn keyword vimTermOption contained t_8b t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RB t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_SR t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xn t_xs t_ZH t_ZR +syn keyword vimTermOption contained t_8f t_AF t_AL t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EI syn match vimTermOption contained "t_%1" syn match vimTermOption contained "t_#2" syn match vimTermOption contained "t_#4" @@ -53,11 +56,64 @@ syn keyword vimGroup contained Comment Constant String Character Number Boolean syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu syn match vimHLGroup contained "Conceal" syn keyword vimOnlyHLGroup contained VisualNOS -syn keyword nvimHLGroup contained EndOfBuffer TermCursor TermCursorNC +syn keyword nvimHLGroup contained EndOfBuffer Substitute TermCursor TermCursorNC QuickFixLine "}}}2 syn case match " Special Vim Highlighting (not automatic) {{{1 +" Set up folding commands +if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[aflmpPrt]' + if g:vimsyn_folding =~# 'a' + com! -nargs=* VimFolda <args> fold + else + com! -nargs=* VimFolda <args> + endif + if g:vimsyn_folding =~# 'f' + com! -nargs=* VimFoldf <args> fold + else + com! -nargs=* VimFoldf <args> + endif + if g:vimsyn_folding =~# 'l' + com! -nargs=* VimFoldl <args> fold + else + com! -nargs=* VimFoldl <args> + endif + if g:vimsyn_folding =~# 'm' + com! -nargs=* VimFoldm <args> fold + else + com! -nargs=* VimFoldm <args> + endif + if g:vimsyn_folding =~# 'p' + com! -nargs=* VimFoldp <args> fold + else + com! -nargs=* VimFoldp <args> + endif + if g:vimsyn_folding =~# 'P' + com! -nargs=* VimFoldP <args> fold + else + com! -nargs=* VimFoldP <args> + endif + if g:vimsyn_folding =~# 'r' + com! -nargs=* VimFoldr <args> fold + else + com! -nargs=* VimFoldr <args> + endif + if g:vimsyn_folding =~# 't' + com! -nargs=* VimFoldt <args> fold + else + com! -nargs=* VimFoldt <args> + endif +else + com! -nargs=* VimFolda <args> + com! -nargs=* VimFoldf <args> + com! -nargs=* VimFoldl <args> + com! -nargs=* VimFoldm <args> + com! -nargs=* VimFoldp <args> + com! -nargs=* VimFoldP <args> + com! -nargs=* VimFoldr <args> + com! -nargs=* VimFoldt <args> +endif + " commands not picked up by the generator (due to non-standard format) syn keyword vimCommand contained py3 @@ -80,8 +136,8 @@ syn match vimNumber "\<0[xX]\x\+" syn match vimNumber "\%(^\|[^a-zA-Z]\)\zs#\x\{6}" " All vimCommands are contained by vimIsCommands. {{{2 -syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimCommand,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd,vimOnlyCommand -syn match vimIsCommand "\<\h\w*\>" contains=vimCommand,vimOnlyCommand +syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd +syn match vimIsCommand "\<\h\w*\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" syn match vimVar "\<[bwglsav]:\h[a-zA-Z0-9#_]*\>" syn match vimFBVar contained "\<[bwglsav]:\h[a-zA-Z0-9#_]*\>" @@ -113,10 +169,10 @@ syn keyword vimFTOption contained detect indent off on plugin " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue -if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'a' +if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a' syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList else - syn region vimAugroup matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList + syn region vimAugroup matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList endif syn match vimAugroup "aug\%[roup]!" contains=vimAugroupKey if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noaugrouperror") @@ -130,7 +186,7 @@ syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperPa syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup -syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar +syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror") syn match vimOperError ")" endif @@ -141,7 +197,7 @@ syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimF syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vimComment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimExecute,vimIf,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand,nvimUnmap,nvimMap syn match vimFunction "\<fu\%[nction]!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody -if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'f' +if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f' syn region vimFuncBody contained fold start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList else syn region vimFuncBody contained start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList @@ -224,10 +280,11 @@ syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+ syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation syn cluster vimSubstList add=vimCollection -syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[:[:alpha:]]\@!" nextgroup=vimSubstPat -syn match vimSubst "s\%[ubstitute][:#[:alpha:]]\@!" nextgroup=vimSubstPat contained -syn match vimSubst "/\zss\%[ubstitute]\ze/" nextgroup=vimSubstPat -syn match vimSubst1 contained "s\%[ubstitute]\>" nextgroup=vimSubstPat +syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(\<s\%[ubstitute]\>\|\<sm\%[agic]\>\|\<sno\%[magic]\>\)[:#[:alpha:]]\@!" nextgroup=vimSubstPat +syn match vimSubst "\%(^\|[^\\]\)\<s\%[ubstitute]\>[:#[:alpha:]]\@!" nextgroup=vimSubstPat contained +syn match vimSubst "/\zs\<s\%[ubstitute]\>\ze/" nextgroup=vimSubstPat +syn match vimSubst "\(:\+\s*\|^\s*\)s\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat +syn match vimSubst1 contained "\<s\%[ubstitute]\>" nextgroup=vimSubstPat syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([^a-zA-Z( \t[\]&]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline syn region vimCollection contained transparent start="\\\@<!\[" skip="\\\[" end="\]" contains=vimCollClass @@ -267,7 +324,7 @@ syn match vimCmplxRepeat '[^a-zA-Z_/\\()]q[0-9a-zA-Z"]\>'lc=1 syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)' " Set command and associated set-options (vimOptions) with comment {{{2 -syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\." end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend oneline contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod,vimTermOption,vimOnlyOption +syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\." end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend oneline contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod syn region vimSetEqual contained start="[=:]\|[-+^]=" skip="\\\\\|\\\s" end="[| \t]\|$"me=e-1 contains=vimCtrlChar,vimSetSep,vimNotation,vimEnvvar oneline syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar syn match vimSetSep contained "[,:]" skipwhite nextgroup=vimCommand @@ -341,8 +398,8 @@ syn case match " User Function Highlighting {{{2 " (following Gautam Iyer's suggestion) " ========================== -syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute -syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation +syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute +syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<return\>\|\<while\>" " Errors And Warnings: {{{2 @@ -388,11 +445,16 @@ syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList " Syntax: cluster {{{2 syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName -syn region vimClusterName contained matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError +syn region vimClusterName contained matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError syn match vimGroupAdd contained "add=" nextgroup=vimGroupList syn match vimGroupRem contained "remove=" nextgroup=vimGroupList syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem +" Syntax: iskeyword {{{2 +syn keyword vimSynType contained iskeyword skipwhite nextgroup=vimIskList +syn match vimIskList contained '\S\+' contains=vimIskSep +syn match vimIskSep contained ',' + " Syntax: include {{{2 syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList syn cluster vimFuncBodyList add=vimSynType @@ -400,14 +462,14 @@ syn cluster vimFuncBodyList add=vimSynType " Syntax: keyword {{{2 syn cluster vimSynKeyGroup contains=vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion -syn region vimSynKeyRegion contained oneline keepend matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup +syn region vimSynKeyRegion contained oneline keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup syn match vimSynKeyOpt contained "\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>" syn cluster vimFuncBodyList add=vimSynType " Syntax: match {{{2 syn cluster vimSynMtchGroup contains=vimMtchComment,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion -syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\k\+" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup +syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup syn match vimSynMtchOpt contained "\<\(conceal\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" if has("conceal") syn match vimSynMtchOpt contained "\<cchar=" nextgroup=vimSynMtchCchar @@ -422,7 +484,7 @@ syn keyword vimSynType contained enable list manual off on reset syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation syn cluster vimSynRegGroup contains=vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion -syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" end="|\|$" contains=@vimSynRegGroup +syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" end="|\|$" contains=@vimSynRegGroup syn match vimSynRegOpt contained "\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>" syn match vimSynReg contained "\(start\|skip\|end\)="he=e-1 nextgroup=vimSynRegPat syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup,vimOnlyHLGroup,nvimHLGroup @@ -448,9 +510,9 @@ syn keyword vimSyncRegion contained region skipwhite nextgroup=vimSynReg syn match vimSyncLinebreak contained "\<linebreaks=" skipwhite nextgroup=vimNumber syn keyword vimSyncLinecont contained linecont skipwhite nextgroup=vimSynRegPat syn match vimSyncLines contained "\(min\|max\)\=lines=" nextgroup=vimNumber -syn match vimSyncGroupName contained "\k\+" skipwhite nextgroup=vimSyncKey +syn match vimSyncGroupName contained "\h\w*" skipwhite nextgroup=vimSyncKey syn match vimSyncKey contained "\<groupthere\|grouphere\>" skipwhite nextgroup=vimSyncGroup -syn match vimSyncGroup contained "\k\+" skipwhite nextgroup=vimSynRegPat,vimSyncNone +syn match vimSyncGroup contained "\h\w*" skipwhite nextgroup=vimSynRegPat,vimSyncNone syn keyword vimSyncNone contained NONE " Additional IsCommand, here by reasons of precedence {{{2 @@ -531,9 +593,14 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e " Allows users to specify the type of embedded script highlighting " they want: (perl/python/ruby/tcl support) " g:vimsyn_embed == 0 : don't embed any scripts -" g:vimsyn_embed ~= 'P' : embed python (but only if vim supports it) +" g:vimsyn_embed =~# 'l' : embed lua +" g:vimsyn_embed =~# 'm' : embed mzscheme +" g:vimsyn_embed =~# 'p' : embed perl +" g:vimsyn_embed =~# 'P' : embed python +" g:vimsyn_embed =~# 'r' : embed ruby +" g:vimsyn_embed =~# 't' : embed tcl if !exists("g:vimsyn_embed") - let g:vimsyn_embed= "P" + let g:vimsyn_embed= "lpPr" endif " [-- lua --] {{{3 @@ -546,9 +613,16 @@ if !filereadable(s:luapath) endif endfor endif - -syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ -syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+ +if g:vimsyn_embed =~# 'l' && filereadable(s:luapath) + unlet! b:current_syntax + exe "syn include @vimLuaScript ".s:luapath + VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript + VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript + syn cluster vimFuncBodyList add=vimLuaRegion +else + syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+ +endif unlet s:luapath " [-- perl --] {{{3 @@ -561,9 +635,18 @@ if !filereadable(s:perlpath) endif endfor endif - -syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ -syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ +if g:vimsyn_embed =~# 'p' && filereadable(s:perlpath) + unlet! b:current_syntax + let s:foldmethod = &l:foldmethod + exe "syn include @vimPerlScript ".s:perlpath + let &l:foldmethod = s:foldmethod + VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPerlScript + VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript + syn cluster vimFuncBodyList add=vimPerlRegion +else + syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ +endif unlet s:perlpath " [-- ruby --] {{{3 @@ -576,9 +659,18 @@ if !filereadable(s:rubypath) endif endfor endif - -syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ -syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+ +if g:vimsyn_embed =~# 'r' && filereadable(s:rubypath) + unlet! b:current_syntax + let s:foldmethod = &l:foldmethod + exe "syn include @vimRubyScript ".s:rubypath + let &l:foldmethod = s:foldmethod + VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimRubyScript + syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript + syn cluster vimFuncBodyList add=vimRubyRegion +else + syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+ +endif unlet s:rubypath " [-- python --] {{{3 @@ -591,16 +683,13 @@ if !filereadable(s:pythonpath) endif endfor endif -if g:vimsyn_embed =~ 'P' && filereadable(s:pythonpath) +if g:vimsyn_embed =~# 'P' && filereadable(s:pythonpath) unlet! b:current_syntax exe "syn include @vimPythonScript ".s:pythonpath - if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'P' - syn region vimPythonRegion fold matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript - syn region vimPythonRegion fold matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript - else - syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript - syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript - endif + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript syn cluster vimFuncBodyList add=vimPythonRegion else syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ @@ -625,11 +714,17 @@ if s:trytcl endif endfor endif - - syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ - syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+ + if g:vimsyn_embed =~# 't' && filereadable(s:tclpath) + unlet! b:current_syntax + exe "syn include @vimTclScript ".s:tclpath + VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript + VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript + syn cluster vimFuncBodyList add=vimTclScript + else + syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+ + endif unlet s:tclpath - else syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+ @@ -646,9 +741,18 @@ if !filereadable(s:mzschemepath) endif endfor endif - -syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ -syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ +if g:vimsyn_embed =~# 'm' && filereadable(s:mzschemepath) + unlet! b:current_syntax + let iskKeep= &isk + exe "syn include @vimMzSchemeScript ".s:mzschemepath + let &isk= iskKeep + VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript + VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript + syn cluster vimFuncBodyList add=vimMzSchemeRegion +else + syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ +endif unlet s:mzschemepath " Synchronize (speed) {{{2 @@ -668,7 +772,6 @@ syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]" " Highlighting Settings {{{2 " ==================== - if !exists("g:vimsyn_noerror") hi def link vimBehaveError vimError hi def link vimCollClassErr vimError @@ -685,14 +788,11 @@ if !exists("g:vimsyn_noerror") hi def link vimSubstFlagErr vimError hi def link vimSynCaseError vimError hi def link vimBufnrWarn vimWarn - hi def link vimOnlyCommand vimError - hi def link vimTermOption vimError - hi def link vimOnlyOption vimError - hi def link vimOnlyHLGroup vimError endif hi def link vimAbb vimCommand hi def link vimAddress vimMark +hi def link vimAugroupError vimError hi def link vimAugroupKey vimCommand hi def link vimAuHighlight vimHighlight hi def link vimAutoCmdOpt vimOption @@ -748,6 +848,7 @@ hi def link vimHLGroup vimGroup hi def link nvimHLGroup vimHLGroup hi def link vimHLMod PreProc hi def link vimInsert vimString +hi def link vimIskSep Delimiter hi def link vimKeyCode vimSpecFile hi def link vimKeyword Statement hi def link vimLet vimCommand @@ -830,6 +931,7 @@ hi def link vimUserAttrbCmpltFunc Special hi def link vimUserAttrbCmplt vimSpecial hi def link vimUserAttrbKey vimOption hi def link vimUserAttrb vimSpecial +hi def link vimUserAttrbError Error hi def link vimUserCmdError Error hi def link vimUserCommand vimCommand hi def link vimUserFunc Normal @@ -841,6 +943,14 @@ let b:current_syntax = "vim" " --------------------------------------------------------------------- " Cleanup: {{{1 +delc VimFolda +delc VimFoldf +delc VimFoldl +delc VimFoldm +delc VimFoldp +delc VimFoldP +delc VimFoldr +delc VimFoldt let &cpo = s:keepcpo unlet s:keepcpo " vim:ts=18 fdm=marker diff --git a/runtime/syntax/viminfo.vim b/runtime/syntax/viminfo.vim index 7af3b89ae0..667e1bab2a 100644 --- a/runtime/syntax/viminfo.vim +++ b/runtime/syntax/viminfo.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Vim .viminfo file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Feb 03 +" Last Change: 2016 Jun 05 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -30,11 +30,15 @@ syn match viminfoOptionName "\*\a*"ms=s+1 contained " Comments syn match viminfoComment "^#.*" +" New style lines. TODO: highlight numbers and strings. +syn match viminfoNew "^|.*" + " Define the default highlighting. " Only used when an item doesn't have highlighting yet hi def link viminfoComment Comment hi def link viminfoError Error hi def link viminfoStatement Statement +hi def link viminfoNew String let b:current_syntax = "viminfo" diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim index 162577669f..0d385a35d0 100644 --- a/runtime/syntax/zsh.vim +++ b/runtime/syntax/zsh.vim @@ -2,7 +2,7 @@ " Language: Zsh shell script " Maintainer: Christian Brabandt <cb@256bit.org> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2015-12-25 +" Latest Revision: 2016-02-15 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-zsh @@ -13,19 +13,29 @@ endif let s:cpo_save = &cpo set cpo&vim -setlocal iskeyword+=- +if v:version > 704 || (v:version == 704 && has("patch1142")) + syn iskeyword @,48-57,_,192-255,#,- +else + setlocal iskeyword+=- +endif +if get(g:, 'zsh_fold_enable', 0) + setlocal foldmethod=syntax +endif syn keyword zshTodo contained TODO FIXME XXX NOTE syn region zshComment oneline start='\%(^\|\s*\)#' end='$' - \ contains=zshTodo,@Spell + \ contains=zshTodo,@Spell fold + +syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!' + \ contains=zshTodo,@Spell fold syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$' syn match zshQuoted '\\.' syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ - \ contains=zshQuoted,@zshDerefs,@zshSubst -syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ + \ contains=zshQuoted,@zshDerefs,@zshSubst fold +syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ \ end=+'+ contains=zshQuoted @@ -45,7 +55,7 @@ syn keyword zshException always syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite -syn match zshKSHFunction contained '\k\+' +syn match zshKSHFunction contained '\w\S\+' syn match zshFunction '^\s*\k\+\ze\s*()' syn match zshOperator '||\|&&\|;\|&!\=' @@ -307,19 +317,21 @@ syn match zshNumber '[+-]\=\d\+\.\d\+\>' " TODO: $[...] is the same as $((...)), so add that as well. syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst syn region zshSubst matchgroup=zshSubstDelim transparent - \ start='\$(' skip='\\)' end=')' contains=TOP -syn region zshParentheses transparent start='(' skip='\\)' end=')' + \ start='\$(' skip='\\)' end=')' contains=TOP fold +syn region zshParentheses transparent start='(' skip='\\)' end=')' fold syn region zshMathSubst matchgroup=zshSubstDelim transparent \ start='\$((' skip='\\)' \ matchgroup=zshSubstDelim end='))' \ contains=zshParentheses,@zshSubst,zshNumber, - \ @zshDerefs,zshString keepend + \ @zshDerefs,zshString keepend fold syn region zshBrackets contained transparent start='{' skip='\\}' - \ end='}' + \ end='}' fold +syn region zshBrackets transparent start='{' skip='\\}' + \ end='}' contains=TOP fold syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}' - \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString + \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+ - \ end=+`+ contains=TOP,zshOldSubst + \ end=+`+ contains=TOP,zshOldSubst fold syn sync minlines=50 maxlines=90 syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)' diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index c53dde8ceb..17cba123a8 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -19,6 +19,12 @@ inoremap <C-U> <C-G>u<C-U> " Switch syntax highlighting on syntax on +" Also switch on highlighting the last used search pattern. +set hlsearch + +" I like highlighting strings inside C comments. +let c_comment_strings=1 + " Enable file type detection. " Use the default filetype settings, so that mail gets 'textwidth' set to 72, " 'cindent' is on in C files, etc. |