summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-08-23 15:31:19 +0200
committerBram Moolenaar <Bram@vim.org>2014-08-23 15:31:19 +0200
commit7b61a546d84ce50f278fcc84090b2d11dbe039eb (patch)
tree9a7d32eeb8d849c5fcec8e19ac071d1186c6db3e
parent92f4baace8af8fbc6ed610ba91268e38a4d555a2 (diff)
downloadvim-git-7b61a546d84ce50f278fcc84090b2d11dbe039eb.tar.gz
Runtime file updates.
-rw-r--r--runtime/doc/autocmd.txt2
-rw-r--r--runtime/doc/tags1
-rw-r--r--runtime/doc/todo.txt8
-rw-r--r--runtime/filetype.vim4
-rw-r--r--runtime/indent/html.vim6
-rw-r--r--runtime/syntax/json.vim151
-rw-r--r--runtime/syntax/rst.vim28
7 files changed, 163 insertions, 37 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 079b91677..03f95cac6 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt* For Vim version 7.4. Last change: 2014 May 02
+*autocmd.txt* For Vim version 7.4. Last change: 2014 Aug 22
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 55f221f48..c0df15d3b 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -3454,6 +3454,7 @@ CTRL-^ editing.txt /*CTRL-^*
CTRL-{char} intro.txt /*CTRL-{char}*
Chinese mbyte.txt /*Chinese*
Cmd-event autocmd.txt /*Cmd-event*
+CmdUndefined autocmd.txt /*CmdUndefined*
Cmdline cmdline.txt /*Cmdline*
Cmdline-mode cmdline.txt /*Cmdline-mode*
CmdwinEnter autocmd.txt /*CmdwinEnter*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 4be7867ef..4b2a3db8d 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.4. Last change: 2014 Aug 22
+*todo.txt* For Vim version 7.4. Last change: 2014 Aug 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -54,10 +54,6 @@ Regexp problems:
Still using freed memory after using setloclist(). (lcd, 2014 Jul 23)
More info Jul 24. Not clear why.
-Patch for:
- CmdUndefined - Like FuncUndefined but for user commands.
-Yasuhiro Matsumoto, 2014 Aug 18
-
Patch to make getregtype() return the right size for non-linux systems.
(Yasuhiro Matsumoto, 2014 Jul 8)
Breaks test_eval. Inefficient, can we only compute y_width when needed?
@@ -265,7 +261,7 @@ Issue 28.
Go through more coverity reports.
Patch to add ":undorecover", get as much text out of the undo file as
-possible. (Christian Brabandt, 2014 Mar 12, update Aug 16)
+possible. (Christian Brabandt, 2014 Mar 12, update Aug 22)
Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24)
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 91afa65a8..68b795ad4 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: 2014 Aug 22
+" Last Change: 2014 Aug 23
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -1011,7 +1011,7 @@ au BufNewFile,BufRead *.jgr setf jgraph
au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial
" JSON
-au BufNewFile,BufRead *.json setf json
+au BufNewFile,BufRead *.json,*.jsonp setf json
" Kixtart
au BufNewFile,BufRead *.kix setf kix
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index b5374bd68..d64a0e5cd 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: 2014 Jul 04
+" Last Change: 2014 Aug 23
" Version: 1.0
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -497,7 +497,7 @@ func! s:FreshState(lnum)
" If previous line ended in a closing tag, line up with the opening tag.
if !swendtag && text =~ '</\w\+\s*>\s*$'
call cursor(state.lnum, 99999)
- normal F<
+ normal! F<
let start_lnum = HtmlIndent_FindStartTag()
if start_lnum > 0
let state.baseindent = indent(start_lnum)
@@ -898,7 +898,7 @@ func! HtmlIndent()
" a tag works very differently. Do not do this when the line starts with
" "<", it gets the "htmlTag" ID but we are not inside a tag then.
if curtext !~ '^\s*<'
- normal ^
+ normal! ^
let stack = synstack(v:lnum, col('.')) " assumes there are no tabs
let foundHtmlString = 0
for synid in reverse(stack)
diff --git a/runtime/syntax/json.vim b/runtime/syntax/json.vim
index f2d880b1d..1fdfea2d0 100644
--- a/runtime/syntax/json.vim
+++ b/runtime/syntax/json.vim
@@ -1,16 +1,143 @@
" Vim syntax file
-" Language: JSON
-" Maintainer: David Barnett <daviebdawg+vim@gmail.com>
-" Last Change: 2014 Jul 16
-
-" For version 5.x: Clear all syntax items.
-" For version 6.x and later: Quit when a syntax file was already loaded.
-if exists('b:current_syntax')
- finish
+" Language: JSON
+" Maintainer: Eli Parra <eli@elzr.com>
+" Last Change: 2014 Aug 23
+" Version: 0.12
+
+if !exists("main_syntax")
+ if version < 600
+ syntax clear
+ elseif exists("b:current_syntax")
+ finish
+ endif
+ let main_syntax = 'json'
+endif
+
+syntax match jsonNoise /\%(:\|,\)/
+
+" NOTE that for the concealing to work your conceallevel should be set to 2
+
+" Syntax: Strings
+" Separated into a match and region because a region by itself is always greedy
+syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
+if has('conceal')
+ syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
+else
+ syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained
+endif
+
+" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
+syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
+
+" Syntax: JSON Keywords
+" Separated into a match and region because a region by itself is always greedy
+syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
+if has('conceal')
+ syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained
+else
+ syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained
+endif
+
+" Syntax: Escape sequences
+syn match jsonEscape "\\["\\/bfnrt]" contained
+syn match jsonEscape "\\u\x\{4}" contained
+
+" Syntax: Numbers
+syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]"
+
+" ERROR WARNINGS **********************************************
+if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
+ " Syntax: Strings should always be enclosed with quotes.
+ syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>"
+ syn match jsonTripleQuotesError /"""/
+
+ " Syntax: An integer part of 0 followed by other digits is not allowed.
+ syn match jsonNumError "-\=\<0\d\.\d*\>"
+
+ " Syntax: Decimals smaller than one should begin with 0 (so .1 should be 0.1).
+ syn match jsonNumError "\:\@<=[[:blank:]\r\n]*\zs\.\d\+"
+
+ " Syntax: No comments in JSON, see http://stackoverflow.com/questions/244777/can-i-comment-a-json-file
+ syn match jsonCommentError "//.*"
+ syn match jsonCommentError "\(/\*\)\|\(\*/\)"
+
+ " Syntax: No semicolons in JSON
+ syn match jsonSemicolonError ";"
+
+ " Syntax: No trailing comma after the last element of arrays or objects
+ syn match jsonTrailingCommaError ",\_s*[}\]]"
+
+ " Syntax: Watch out for missing commas between elements
+ syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
+ syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
+ syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
+ syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
+endif
+
+" ********************************************** END OF ERROR WARNINGS
+" Allowances for JSONP: function call at the beginning of the file,
+" parenthesis and semicolon at the end.
+" Function name validation based on
+" http://stackoverflow.com/questions/2008279/validate-a-javascript-function-name/2008444#2008444
+syn match jsonPadding "\%^[[:blank:]\r\n]*[_$[:alpha:]][_$[:alnum:]]*[[:blank:]\r\n]*("
+syn match jsonPadding ");[[:blank:]\r\n]*\%$"
+
+" Syntax: Boolean
+syn match jsonBoolean /\(true\|false\)\(\_s\+\ze"\)\@!/
+
+" Syntax: Null
+syn keyword jsonNull null
+
+" Syntax: Braces
+syn region jsonFold matchgroup=jsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold
+syn region jsonFold matchgroup=jsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold
+
+" 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_json_syn_inits")
+ if version < 508
+ let did_json_syn_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+ HiLink jsonPadding Operator
+ HiLink jsonString String
+ HiLink jsonTest Label
+ HiLink jsonEscape Special
+ HiLink jsonNumber Number
+ HiLink jsonBraces Delimiter
+ HiLink jsonNull Function
+ HiLink jsonBoolean Boolean
+ HiLink jsonKeyword Label
+
+ if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
+ HiLink jsonNumError Error
+ HiLink jsonCommentError Error
+ HiLink jsonSemicolonError Error
+ HiLink jsonTrailingCommaError Error
+ HiLink jsonMissingCommaError Error
+ HiLink jsonStringSQError Error
+ HiLink jsonNoQuotesError Error
+ HiLink jsonTripleQuotesError Error
+ endif
+ HiLink jsonQuote Quote
+ HiLink jsonNoise Noise
+ delcommand HiLink
+endif
+
+let b:current_syntax = "json"
+if main_syntax == 'json'
+ unlet main_syntax
endif
-" Use JavaScript syntax. JSON is a subset of JavaScript.
-runtime! syntax/javascript.vim
-unlet b:current_syntax
+" Vim settings
+" vim: ts=8 fdm=marker
-let b:current_syntax = 'json'
+" MIT License
+" Copyright (c) 2013, Jeroen Ruigrok van der Werven, Eli Parra
+"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+"THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+"See https://twitter.com/elzr/status/294964017926119424
diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim
index 425d22511..fce9e5dd3 100644
--- a/runtime/syntax/rst.vim
+++ b/runtime/syntax/rst.vim
@@ -1,7 +1,8 @@
" Vim syntax file
" Language: reStructuredText documentation format
-" Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2013-11-26
+" Maintainer: Marshall Ward <marshall.ward@gmail.com>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2014-08-23
if exists("b:current_syntax")
finish
@@ -47,7 +48,7 @@ syn match rstSimpleTableLines contained display
syn cluster rstDirectives contains=rstFootnote,rstCitation,
\ rstHyperlinkTarget,rstExDirective
-syn match rstExplicitMarkup '^\.\.\_s'
+syn match rstExplicitMarkup '^\s*\.\.\_s'
\ nextgroup=@rstDirectives,rstComment,rstSubstitutionDefinition
let s:ReferenceName = '[[:alnum:]]\+\%([_.-][[:alnum:]]\+\)*'
@@ -99,11 +100,11 @@ function! s:DefineInlineMarkup(name, start, middle, end)
\ ""
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'")
- call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"')
- call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '(', ')')
- call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\[', '\]')
- call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}')
- call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>')
+ call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"')
+ call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '(', ')')
+ call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\[', '\]')
+ call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}')
+ call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>')
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\%(^\|\s\|[/:]\)', '')
@@ -136,23 +137,24 @@ 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+
+ \ start=+\%(sourcecode\|code\%(-block\)\=\)::\_s*\n\ze\z(\s\+\)+
\ skip=+^$+
- \ end=+^\s\@!+
+ \ end=+^\z1\@!+
\ contains=@NoSpell
syn cluster rstDirectives add=rstCodeBlock
if !exists('g:rst_syntax_code_list')
- let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php', 'python', 'perl']
+ let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php',
+ \ 'python', 'perl', 'sh']
endif
for code in g:rst_syntax_code_list
unlet! b:current_syntax
exe 'syn include @rst'.code.' syntax/'.code.'.vim'
exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold '
- \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\s*$# '
+ \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\_s*\n\ze\z(\s\+\)# '
\.'skip=#^$# '
- \.'end=#^\s\@!# contains=@NoSpell,@rst'.code.' keepend'
+ \.'end=#^\z1\@!# contains=@NoSpell,@rst'.code
exe 'syn cluster rstDirectives add=rstDirective'.code
endfor