diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index a747058991..0099d14822 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -236,7 +236,7 @@ If you want to keep the changed buffer without saving it, switch on the *:vie* *:view* :vie[w][!] [++opt] [+cmd] file - When used in Ex mode: Leave |Ex mode|, go back to + When used in Ex mode: Leave |Ex-mode|, go back to Normal mode. Otherwise same as |:edit|, but set 'readonly' option for this buffer. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d7ab0415f2..7bf148a833 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1870,6 +1870,8 @@ v:termresponse The escape sequence returned by the terminal for the DA *v:testing* *testing-variable* v:testing Must be set before using `test_garbagecollect_now()`. + Also, when set certain error messages won't be shown for 2 + seconds. (e.g. "'dictionary' option is empty") *v:this_session* *this_session-variable* v:this_session Full filename of the last loaded or saved session file. See diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index e78b4cc942..fa7d01aa5f 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -556,7 +556,8 @@ Upper and lowercase differences are ignored. *map-comments* It is not possible to put a comment after these commands, because the '"' -character is considered to be part of the {lhs} or {rhs}. +character is considered to be part of the {lhs} or {rhs}. However, one can +use |", since this starts a new, empty command with a comment. *map_bar* *map-bar* Since the '|' character is used to separate a map command from the next diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 81137b6069..600eb3ab9e 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -184,7 +184,7 @@ l or *l* *$* ** ** $ or To the end of the line. When a count is given also go - [count - 1] lines downward |inclusive|. + [count - 1] lines downward. |inclusive| motion. In Visual mode the cursor goes to just after the last character in the line. When 'virtualedit' is active, "$" may move the cursor diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 7d22fa0222..433b083942 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -959,8 +959,8 @@ A jump table for the options with a short description can be found at |Q_op|. wildmode More matches in |cmdline-completion| available (depends on the 'wildmode' setting). - This is most useful, to fine tune when in insert mode the bell should - be rung. For normal mode and ex commands, the bell is often rung to + This is most useful to fine tune when in Insert mode the bell should + be rung. For Normal mode and Ex commands, the bell is often rung to indicate that an error occurred. It can be silenced by adding the "error" keyword. @@ -3099,6 +3099,28 @@ A jump table for the options with a short description can be found at |Q_op|. global The builtin |highlight-groups| cannot be changed. + *'history'* *'hi'* +'history' 'hi' number (Vim default: 10000, Vi default: 0) + global + A history of ":" commands, and a history of previous search patterns + is remembered. This option decides how many entries may be stored in + each of these histories (see |cmdline-editing|). + The maximum value is 10000. + + *'hkmap'* *'hk'* *'nohkmap'* *'nohk'* +'hkmap' 'hk' boolean (default off) + global + When on, the keyboard is mapped for the Hebrew character set. + Normally you would set 'allowrevins' and use CTRL-_ in insert mode to + toggle this option. See |rileft.txt|. + + *'hkmapp'* *'hkp'* *'nohkmapp'* *'nohkp'* +'hkmapp' 'hkp' boolean (default off) + global + When on, phonetic keyboard mapping is used. 'hkmap' must also be on. + This is useful if you have a non-Hebrew keyboard. + See |rileft.txt|. + *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'* 'hlsearch' 'hls' boolean (default on) global @@ -3122,28 +3144,6 @@ A jump table for the options with a short description can be found at |Q_op|. You can specify whether the highlight status is restored on startup with the 'h' flag in 'shada' |shada-h|. - *'history'* *'hi'* -'history' 'hi' number (Vim default: 10000, Vi default: 0) - global - A history of ":" commands, and a history of previous search patterns - is remembered. This option decides how many entries may be stored in - each of these histories (see |cmdline-editing|). - The maximum value is 10000. - - *'hkmap'* *'hk'* *'nohkmap'* *'nohk'* -'hkmap' 'hk' boolean (default off) - global - When on, the keyboard is mapped for the Hebrew character set. - Normally you would set 'allowrevins' and use CTRL-_ in insert mode to - toggle this option. See |rileft.txt|. - - *'hkmapp'* *'hkp'* *'nohkmapp'* *'nohkp'* -'hkmapp' 'hkp' boolean (default off) - global - When on, phonetic keyboard mapping is used. 'hkmap' must also be on. - This is useful if you have a non-Hebrew keyboard. - See |rileft.txt|. - *'icon'* *'noicon'* 'icon' boolean (default off, on when title can be restored) global diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index d7803d1665..b7025c8e7e 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -856,8 +856,8 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): inside the Visual area put it at the start and just before the end of the pattern, e.g.: > /\%Vfoo.*ba\%Vr -< This works if "foo bar" (or more) was Visually selected. This: > - /\%Vfoo.*ba\%Vr +< This also works if only "foo bar" was Visually selected. This: > + /\%Vfoo.*bar\%V < would match "foo bar" if the Visual selection continues after the "r". Only works for the current buffer. diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 44e29c6f3b..4c9a68fa63 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -32,10 +32,13 @@ 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 -in files. A location list is associated with a window and each window can -have a separate location list. A location list can be associated with only -one window. The location list is independent of the quickfix list. +A location list is a window-local quickfix list. You get one after commands +like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a +location list instead of a quickfix list as the corresponding `:vimgrep`, +`:grep`, `:helpgrep`, `:make` do. +A location list is associated with a window and each window can 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 longer any references to a location list, diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index 9103750a5d..a1e3d606ec 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -543,7 +543,7 @@ Summary: *help-summary* > 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 +9) Commands specifically for debugging start with ">". To go to the help for the "cont" debug command: > :help >cont diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 01ba028d64..79fbcbca00 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2017 Mar 04 +" Last Change: 2017 Mar 13 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1362,6 +1362,9 @@ endfunc " Not Quite C au BufNewFile,BufRead *.nqc setf nqc +" NSE - Nmap Script Engine - uses Lua syntax +au BufNewFile,BufRead *.nse setf lua + " NSIS au BufNewFile,BufRead *.nsi,*.nsh setf nsis @@ -2277,7 +2280,7 @@ au BufNewFile,BufRead .tidyrc,tidyrc setf tidy au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf " tmux configuration -au BufNewFile,BufRead tmux*.conf setf tmux +au BufNewFile,BufRead {.,}tmux*.conf setf tmux " TPP - Text Presentation Program au BufNewFile,BufReadPost *.tpp setf tpp diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim index c23adc4232..29711fb093 100644 --- a/runtime/ftplugin/hamster.vim +++ b/runtime/ftplugin/hamster.vim @@ -1,8 +1,8 @@ " Vim filetype plugin " Language: Hamster Script " Version: 2.0.6.0 -" Maintainer: David Fishburn -" Last Change: Wed Nov 08 2006 12:03:09 PM +" Maintainer: David Fishburn +" Last Change: 2017 Mar 07 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -13,6 +13,7 @@ endif let b:did_ftplugin = 1 let s:cpo_save = &cpo +set cpo&vim set cpo-=C let b:undo_ftplugin = "setl fo< com< tw< commentstring<" diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index c2bc857947..4d6fcd9564 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -1,8 +1,8 @@ " SQL filetype plugin file " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) -" Version: 11.0 +" Version: 12.0 " Maintainer: David Fishburn -" Last Change: 2013 May 13 +" Last Change: 2017 Mar 07 " Download: http://vim.sourceforge.net/script.php?script_id=454 " For more details please use: @@ -36,6 +36,14 @@ " " History " +" Version 12.0 (April 2013) +" +" NF: Added support for "BEGIN TRY ... END TRY ... BEGIN CATCH ... END CATCH +" BF: This plugin is designed to be used with other plugins to enable the +" SQL completion with Perl, Python, Java, ... The loading mechanism +" was not checking if the SQL objects were created, which can lead to +" the plugin not loading the SQL support. +" " Version 11.0 (May 2013) " " NF: Updated to use SyntaxComplete's new regex support for syntax groups. @@ -80,15 +88,17 @@ " Only do this when not done yet for this buffer -if exists("b:did_ftplugin") - finish +" This ftplugin can be used with other ftplugins. So ensure loading +" happens if all elements of this plugin have not yet loaded. +if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql' + finish endif let s:save_cpo = &cpo set cpo&vim " Disable autowrapping for code, but enable for comments -" t Auto-wrap text using textwidth +" t Auto-wrap text using textwidth " c Auto-wrap comments using textwidth, inserting the current comment " leader automatically. setlocal formatoptions-=t @@ -171,6 +181,9 @@ if !exists("*SQL_SetType") if exists("b:current_syntax") " echomsg 'SQLSetType - clearing syntax' syntax clear + if exists("b:current_syntax") + unlet b:current_syntax + endif endif if exists("b:did_indent") " echomsg 'SQLSetType - clearing indent' @@ -187,7 +200,7 @@ if !exists("*SQL_SetType") " Do not specify a buffer local variable if it is " the default value if new_sql_type == 'sql' - let new_sql_type = 'sqloracle' + let new_sql_type = 'sqloracle' endif let b:sql_type_override = new_sql_type @@ -234,25 +247,26 @@ if exists("b:sql_type_override") " echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim' if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != '' exec 'runtime ftplugin/'.b:sql_type_override.'.vim' - " else - " echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default' + " else + " echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default' endif elseif exists("g:sql_type_default") " echo 'sourcing global ftplugin/'.g:sql_type_default.'.vim' if globpath(&runtimepath, 'ftplugin/'.g:sql_type_default.'.vim') != '' exec 'runtime ftplugin/'.g:sql_type_default.'.vim' - " else - " echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default' + " else + " echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default' endif endif " If the above runtime command succeeded, do not load the default settings -if exists("b:did_ftplugin") - finish +" as they should have already been loaded from a previous run. +if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql' + finish endif let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" . - \ " | unlet! b:browsefilter b:match_words" + \ " | unlet! b:browsefilter b:match_words" " Don't load another plugin for this buffer let b:did_ftplugin = 1 @@ -261,7 +275,7 @@ let b:current_ftplugin = 'sql' " Win32 can filter files in the browse dialog if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" endif " Some standard expressions for use with the matchit strings @@ -312,14 +326,24 @@ if !exists("b:match_words") " WHEN column_not_found THEN " WHEN OTHERS THEN " + " begin try + " end try + " begin catch + " end catch + " " create[ or replace] procedure|function|event - " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. + " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. " For ColdFusion support setlocal matchpairs+=<:> let b:match_words = &matchpairs . - \ ',\:\\W*$,'. - \ + \ ',\%(\\)\@!:\\W*$,'. + \ + \ '\:'. + \ '\:'. + \ '\:'. + \ '\,'. + \ \ s:notend . '\:'. \ '\\|\\|\:'. \ '\,'. @@ -339,14 +363,14 @@ if !exists("b:match_words") \ '\%(\' - " \ '\\|\:'. - " \ '\\(;\)\?\s*$' - " \ '\:'.s:when_no_matched_or_others. - " \ ':\,'. - " - " \ '\%(\\|\%('. s:notend . '\\)\):'. - " \ '\%(\\|'.s:when_no_matched_or_others.'\):'. - " \ '\%(\%(\\)\|\\),' . + " \ '\\|\:'. + " \ '\\(;\)\?\s*$' + " \ '\:'.s:when_no_matched_or_others. + " \ ':\,'. + " + " \ '\%(\\|\%('. s:notend . '\\)\):'. + " \ '\%(\\|'.s:when_no_matched_or_others.'\):'. + " \ '\%(\%(\\)\|\\),' . endif " Define how to find the macro definition of a variable using the various diff --git a/runtime/ftplugin/tmux.vim b/runtime/ftplugin/tmux.vim index 9c92ff9c6e..ed9154924b 100644 --- a/runtime/ftplugin/tmux.vim +++ b/runtime/ftplugin/tmux.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file -" Language: Tmux config -" Maintainer: Eric Pruitt -" Last Change: 2017 Mar 04 +" Language: tmux(1) configuration file +" URL: https://github.com/ericpruitt/tmux.vim/ +" Maintainer: Eric Pruitt +" Last Changed: 2017 Mar 10 if exists("b:did_ftplugin") finish diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim index 779cee9e6f..5633362367 100644 --- a/runtime/indent/dtd.vim +++ b/runtime/indent/dtd.vim @@ -84,7 +84,7 @@ function GetDTDIndent() let [declaration, end] = s:lex1(line, col) if declaration == "" - return indent + &sw + return indent + shiftwidth() elseif declaration == '--' " We’re looking at a comment. Now, simply determine if the comment is " terminated or not. If it isn’t, let Vim take care of that using @@ -100,7 +100,7 @@ function GetDTDIndent() " Check for element name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Check for token following element name. This can be a specification of @@ -113,7 +113,7 @@ function GetDTDIndent() let n += 1 endwhile if token == "" - return indent + &sw + return indent + shiftwidth() endif " Next comes the content model. If the token we’ve found isn’t a @@ -148,7 +148,7 @@ function GetDTDIndent() return indent endif " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + &sw) + return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + shiftwidth()) endif " If we’ve seen an addition or exception already and this is of the same @@ -167,7 +167,7 @@ function GetDTDIndent() " Check for element name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Check for any number of attributes. @@ -180,7 +180,7 @@ function GetDTDIndent() let [name, end] = s:lex(line, end) if name == "" " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw) + return getline(v:lnum) =~ '^\s*>' ? indent : (indent + shiftwidth()) elseif name == ">" return indent endif @@ -194,14 +194,14 @@ function GetDTDIndent() " (CDATA|NMTOKEN|NMTOKENS|ID|IDREF|IDREFS|ENTITY|ENTITIES)? let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)') if value == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 elseif value == 'NOTATION' " If this is a enumerated value based on notations, read another token " for the actual value. If it doesn’t exist, indent three levels. " TODO: If validating according to above, value must be equal to '('. let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)') if value == "" - return indent + &sw * 3 + return indent + shiftwidth() * 3 endif endif @@ -216,13 +216,13 @@ function GetDTDIndent() " two levels. let [default, end] = s:lex(line, end, '^\%("\_[^"]*"\|#\(REQUIRED\|IMPLIED\|FIXED\)\)') if default == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 elseif default == '#FIXED' " We need to look for the fixed value. If non exists, indent three " levels. let [default, end] = s:lex(line, end, '^"\_[^"]*"') if default == "" - return indent + &sw * 3 + return indent + shiftwidth() * 3 endif endif endwhile @@ -233,11 +233,11 @@ function GetDTDIndent() " again, if none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() elseif name == '%' let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif endif @@ -256,27 +256,27 @@ function GetDTDIndent() " we’re now done with this entity. let [value, end] = s:lex(line, end) if value == "" - return indent + &sw + return indent + shiftwidth() elseif value == 'SYSTEM' || value == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif if value == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif endif let [ndata, end] = s:lex(line, end) if ndata == "" - return indent + &sw + return indent + shiftwidth() endif let [name, end] = s:lex(line, end) - return name == "" ? (indent + &sw * 2) : indent + return name == "" ? (indent + shiftwidth() * 2) : indent else return indent endif @@ -284,24 +284,24 @@ function GetDTDIndent() " Check for notation name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Now check for the external ID. If none exists, indent one level. let [id, end] = s:lex(line, end) if id == "" - return indent + &sw + return indent + shiftwidth() elseif id == 'SYSTEM' || id == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif if id == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\|>\)') if quoted_string == "" " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw * 2) + return getline(v:lnum) =~ '^\s*>' ? indent : (indent + shiftwidth() * 2) elseif quoted_string == '>' return indent endif diff --git a/runtime/indent/eiffel.vim b/runtime/indent/eiffel.vim index 87e82e833d..d7667a8346 100644 --- a/runtime/indent/eiffel.vim +++ b/runtime/indent/eiffel.vim @@ -2,9 +2,10 @@ " Language: Eiffel " Maintainer: Jocelyn Fiat " Previous-Maintainer: David Clarke +" Contributions from: Takuya Fujiwara " Contributions from: Thilo Six -" $Date: 2004/12/09 21:33:52 $ -" $Revision: 1.3 $ +" $Date: 2017/03/08 06:00:00 $ +" $Revision: 1.4 $ " URL: https://github.com/eiffelhub/vim-eiffel " Only load this indent file when no other was loaded. @@ -28,7 +29,7 @@ let b:undo_indent = "setl smartindent< indentkeys< indentexpr< autoindent< comme " Define some stuff " keywords grouped by indenting let s:trust_user_indent = '\(+\)\(\s*\(--\).*\)\=$' -let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>' +let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|across\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>' let s:outdent = '^\s*\(else\|invariant\|variant\|do\|require\|until\|loop\|local\)\>' let s:no_indent = '^\s*\(class\|feature\|creation\|inherit\)\>' let s:single_dent = '^[^-]\+[[:alnum:]]\+ is\(\s*\(--\).*\)\=$' @@ -63,23 +64,23 @@ function GetEiffelIndent() " Add a 'shiftwidth' after lines that start with an indent word let ind = indent(lnum) if getline(lnum) =~ s:relative_indent - let ind = ind + &sw + let ind = ind + shiftwidth() endif " Indent to single indent if getline(v:lnum) =~ s:single_dent && getline(v:lnum) !~ s:relative_indent \ && getline(v:lnum) !~ '\s*\<\(and\|or\|implies\)\>' - let ind = &sw + let ind = shiftwidth() endif " Indent to double indent if getline(v:lnum) =~ s:inheritance_dent - let ind = 2 * &sw + let ind = 2 * shiftwidth() endif " Indent line after the first line of the function definition if getline(lnum) =~ s:single_dent - let ind = ind + &sw + let ind = ind + shiftwidth() endif " The following should always be at the start of a line, no indenting @@ -91,17 +92,17 @@ function GetEiffelIndent() " or first thing after the 'do' if getline(v:lnum) =~ s:outdent && getline(v:lnum - 1) !~ s:single_dent \ && getline(v:lnum - 1) !~ '^\s*do\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Subtract a shiftwidth for end statements if getline(v:lnum) =~ '^\s*end\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " set indent of zero end statements that are at an indent of 3, this should " only ever be the class's end. - if getline(v:lnum) =~ '^\s*end\>' && ind == &sw + if getline(v:lnum) =~ '^\s*end\>' && ind == shiftwidth() let ind = 0 endif diff --git a/runtime/indent/eterm.vim b/runtime/indent/eterm.vim index e5fea1d3be..8ee342fcfa 100644 --- a/runtime/indent/eterm.vim +++ b/runtime/indent/eterm.vim @@ -25,11 +25,11 @@ function GetEtermIndent() let ind = indent(lnum) if getline(lnum) =~ '^\s*begin\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~ '^\s*end\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/framescript.vim b/runtime/indent/framescript.vim index e35d00eb02..f9a274eab6 100644 --- a/runtime/indent/framescript.vim +++ b/runtime/indent/framescript.vim @@ -30,11 +30,11 @@ function GetFrameScriptIndent() let ind = indent(lnum) if getline(lnum) =~? '^\s*\%(If\|Loop\|Sub\)' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*\%(Else\|End\%(If\|Loop\|Sub\)\)' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/java.vim b/runtime/indent/java.vim index e0aec0faef..49f8010d21 100644 --- a/runtime/indent/java.vim +++ b/runtime/indent/java.vim @@ -1,12 +1,14 @@ " Vim indent file " Language: Java " Previous Maintainer: Toby Allsopp -" Current Maintainer: Hong Xu -" Last Change: 2012 May 18 -" Version: 1.0 +" Current Maintainer: Hong Xu +" Homepage: http://www.vim.org/scripts/script.php?script_id=3899 +" https://github.com/xuhdev/indent-java.vim +" Last Change: 2016 Mar 7 +" Version: 1.1 " License: Same as Vim. -" Copyright (c) 2012 Hong Xu -" Before 2012, this file is maintained by Toby Allsopp. +" Copyright (c) 2012-2016 Hong Xu +" Before 2012, this file was maintained by Toby Allsopp. " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -29,6 +31,7 @@ let b:undo_indent = "set cin< cino< indentkeys< indentexpr<" if exists("*GetJavaIndent") finish endif + let s:keepcpo= &cpo set cpo&vim @@ -70,7 +73,7 @@ function GetJavaIndent() " If the previous line starts with '@', we should have the same indent as " the previous one - if getline(lnum) =~ '^\s*@\S\+\s*$' + if getline(lnum) =~ '^\s*@.*$' return indent(lnum) endif @@ -85,9 +88,9 @@ function GetJavaIndent() " Try to align "throws" lines for methods and "extends" and "implements" for " classes. - if getline(v:lnum) =~ '^\s*\(extends\|implements\)\>' - \ && getline(lnum) !~ '^\s*\(extends\|implements\)\>' - let theIndent = theIndent + &sw + if getline(v:lnum) =~ '^\s*\(throws\|extends\|implements\)\>' + \ && getline(lnum) !~ '^\s*\(throws\|extends\|implements\)\>' + let theIndent = theIndent + shiftwidth() endif " correct for continuation lines of "throws", "implements" and "extends" @@ -96,27 +99,27 @@ function GetJavaIndent() if strlen(cont_kw) > 0 let amount = strlen(cont_kw) + 1 if getline(lnum) !~ ',\s*$' - let theIndent = theIndent - (amount + &sw) + let theIndent = theIndent - (amount + shiftwidth()) if theIndent < 0 let theIndent = 0 endif elseif prev == lnum let theIndent = theIndent + amount if cont_kw ==# 'throws' - let theIndent = theIndent + &sw + let theIndent = theIndent + shiftwidth() endif endif elseif getline(prev) =~ '^\s*\(throws\|implements\|extends\)\>' \ && (getline(prev) =~ '{\s*$' \ || getline(v:lnum) =~ '^\s*{\s*$') - let theIndent = theIndent - &sw + let theIndent = theIndent - shiftwidth() endif " When the line starts with a }, try aligning it with the matching {, " skipping over "throws", "extends" and "implements" clauses. if getline(v:lnum) =~ '^\s*}\s*\(//.*\|/\*.*\)\=$' call cursor(v:lnum, 1) - silent normal % + silent normal! % let lnum = line('.') if lnum < v:lnum while lnum > 1 diff --git a/runtime/indent/ld.vim b/runtime/indent/ld.vim index 6544c4d511..a72a3a9548 100644 --- a/runtime/indent/ld.vim +++ b/runtime/indent/ld.vim @@ -65,7 +65,7 @@ function GetLDIndent() if line =~ '^\s*\*' return cindent(v:lnum) elseif line =~ '^\s*}' - return indent(v:lnum) - &sw + return indent(v:lnum) - shiftwidth() endif let pnum = s:prevnonblanknoncomment(v:lnum - 1) @@ -73,11 +73,11 @@ function GetLDIndent() return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw + let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() let pline = getline(pnum) if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw + let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() endif return ind diff --git a/runtime/indent/make.vim b/runtime/indent/make.vim index 2a4b4580a9..66a8a40173 100644 --- a/runtime/indent/make.vim +++ b/runtime/indent/make.vim @@ -48,14 +48,14 @@ function GetMakeIndent() if prev_prev_line =~ s:continuation_rx return indent(prev_lnum) elseif prev_line =~ s:rule_rx - return &sw + return shiftwidth() elseif prev_line =~ s:assignment_rx call cursor(prev_lnum, 1) if search(s:assignment_rx, 'W') != 0 return virtcol('.') - 1 else " TODO: ? - return &sw + return shiftwidth() endif else " TODO: OK, this might be a continued shell command, so perhaps indent @@ -66,7 +66,7 @@ function GetMakeIndent() " return indent(prev_lnum) + 2 " endif "endif - return indent(prev_lnum) + &sw + return indent(prev_lnum) + shiftwidth() endif elseif prev_prev_line =~ s:continuation_rx let folded_line = s:remove_continuation(prev_prev_line) . ' ' . s:remove_continuation(prev_line) @@ -102,13 +102,13 @@ function GetMakeIndent() return &ts endif elseif prev_line =~ s:conditional_directive_rx - return &sw + return shiftwidth() else let line = getline(v:lnum) if line =~ s:just_inserted_rule_rx return 0 elseif line =~ s:end_conditional_directive_rx - return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - &sw + return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - shiftwidth() else return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) endif diff --git a/runtime/indent/readline.vim b/runtime/indent/readline.vim index a58cc411b8..e202ddfd89 100644 --- a/runtime/indent/readline.vim +++ b/runtime/indent/readline.vim @@ -25,11 +25,11 @@ function GetReadlineIndent() let ind = indent(lnum) if getline(lnum) =~ '^\s*$\(if\|else\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/sas.vim b/runtime/indent/sas.vim new file mode 100644 index 0000000000..d591b2796e --- /dev/null +++ b/runtime/indent/sas.vim @@ -0,0 +1,138 @@ +" Vim indent file +" Language: SAS +" Maintainer: Zhen-Huan Hu +" Version: 3.0.1 +" Last Change: Mar 13, 2017 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetSASIndent() +setlocal indentkeys+=;,=~data,=~proc,=~macro + +if exists("*GetSASIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Regex that captures the start of a data/proc section +let s:section_str = '\v%(^|;)\s*%(data|proc)>' +" Regex that captures the end of a run-processing section +let s:section_run = '\v%(^|;)\s*run\s*;' +" Regex that captures the end of a data/proc section +let s:section_end = '\v%(^|;)\s*%(quit|enddata)\s*;' + +" Regex that captures the start of a control block (anything inside a section) +let s:block_str = '\v<%(do>%([^;]+<%(to|over)>[^;]+)=|%(define|layout|method|select)>[^;]+|begingraph)\s*;' +" Regex that captures the end of a control block (anything inside a section) +let s:block_end = '\v<%(end|endlayout|endgraph)\s*;' + +" Regex that captures the start of a macro +let s:macro_str = '\v%(^|;)\s*\%macro>' +" Regex that captures the end of a macro +let s:macro_end = '\v%(^|;)\s*\%mend\s*;' + +" Regex that defines the end of the program +let s:program_end = '\v%(^|;)\s*endsas\s*;' + +" List of procs supporting run-processing +let s:run_processing_procs = [ + \ 'catalog', 'chart', 'datasets', 'document', 'ds2', 'plot', 'sql', + \ 'gareabar', 'gbarline', 'gchart', 'gkpi', 'gmap', 'gplot', 'gradar', 'greplay', 'gslide', 'gtile', + \ 'anova', 'arima', 'catmod', 'factex', 'glm', 'model', 'optex', 'plan', 'reg', + \ 'iml', + \ ] + +" Find the line number of previous keyword defined by the regex +function! s:PrevMatch(lnum, regex) + let prev_lnum = prevnonblank(a:lnum - 1) + while prev_lnum > 0 + let prev_line = getline(prev_lnum) + if prev_line =~ a:regex + break + else + let prev_lnum = prevnonblank(prev_lnum - 1) + endif + endwhile + return prev_lnum +endfunction + +" Main function +function! GetSASIndent() + let prev_lnum = prevnonblank(v:lnum - 1) + if prev_lnum ==# 0 + " Leave the indentation of the first line unchanged + return indent(1) + else + let prev_line = getline(prev_lnum) + " Previous non-blank line contains the start of a macro/section/block + " while not the end of a macro/section/block (at the same line) + if (prev_line =~ s:section_str && prev_line !~ s:section_run && prev_line !~ s:section_end) || + \ (prev_line =~ s:block_str && prev_line !~ s:block_end) || + \ (prev_line =~ s:macro_str && prev_line !~ s:macro_end) + let ind = indent(prev_lnum) + &sts + elseif prev_line =~ s:section_run && prev_line !~ s:section_end + let prev_section_str_lnum = s:PrevMatch(v:lnum, s:section_str) + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + " Check if the section supports run-processing + if prev_section_end_lnum < prev_section_str_lnum && + \ getline(prev_section_str_lnum) =~ '\v%(^|;)\s*proc\s+%(' . + \ join(s:run_processing_procs, '|') . ')>' + let ind = indent(prev_lnum) + &sts + else + let ind = indent(prev_lnum) + endif + else + let ind = indent(prev_lnum) + endif + endif + " Re-adjustments based on the inputs of the current line + let curr_line = getline(v:lnum) + if curr_line =~ s:program_end + " End of the program + " Same indentation as the first non-blank line + return indent(nextnonblank(1)) + elseif curr_line =~ s:macro_end + " Current line is the end of a macro + " Match the indentation of the start of the macro + return indent(s:PrevMatch(v:lnum, s:macro_str)) + elseif curr_line =~ s:block_end && curr_line !~ s:block_str + " Re-adjust if current line is the end of a block + " while not the beginning of a block (at the same line) + " Returning the indent of previous block start directly + " would not work due to nesting + let ind = ind - &sts + elseif curr_line =~ s:section_str || curr_line =~ s:section_run || curr_line =~ s:section_end + " Re-adjust if current line is the start/end of a section + " since the end of a section could be inexplicit + let prev_section_str_lnum = s:PrevMatch(v:lnum, s:section_str) + " Check if the previous section supports run-processing + if getline(prev_section_str_lnum) =~ '\v%(^|;)\s*proc\s+%(' . + \ join(s:run_processing_procs, '|') . ')>' + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + else + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:section_run), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + endif + if prev_section_end_lnum < prev_section_str_lnum + let ind = ind - &sts + endif + endif + return ind +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/scala.vim b/runtime/indent/scala.vim index f97c79bbab..6fd8ca9d81 100644 --- a/runtime/indent/scala.vim +++ b/runtime/indent/scala.vim @@ -412,24 +412,24 @@ function! GetScalaIndent() if prevline =~ '^\s*\.' return ind else - return ind + &shiftwidth + return ind + shiftwidth() endif endif " Indent html literals if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$' call scala#ConditionalConfirm("3") - return ind + &shiftwidth + return ind + shiftwidth() endif " assumes curly braces around try-block if curline =~ '^\s*}\s*\' - return ind - &shiftwidth + return ind - shiftwidth() elseif curline =~ '^\s*\' return ind endif - " Add a 'shiftwidth' after lines that start a block + " Add a shiftwidth()' after lines that start a block " If 'if', 'for' or 'while' end with ), this is a one-line block " If 'val', 'var', 'def' end with =, this is a one-line block if (prevline =~ '^\s*\<\%(\%(}\?\s*else\s\+\)\?if\|for\|while\)\>.*[)=]\s*$' && scala#NumberOfBraceGroups(prevline) <= 1) @@ -438,7 +438,7 @@ function! GetScalaIndent() \ || prevline =~ '^\s*\%(}\s*\)\?\\s*$' \ || prevline =~ '=\s*$' call scala#ConditionalConfirm("4") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() elseif prevline =~ '^\s*\<\%(}\?\s*else\s\+\)\?if\>' && curline =~ '^\s*}\?\s*\' return ind endif @@ -447,7 +447,7 @@ function! GetScalaIndent() let bracketCount = scala#CountBrackets(prevline, '{', '}') if bracketCount > 0 || prevline =~ '.*{\s*$' call scala#ConditionalConfirm("5b") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() elseif bracketCount < 0 call scala#ConditionalConfirm("6b") " if the closing brace actually completes the braces entirely, then we @@ -475,7 +475,7 @@ function! GetScalaIndent() let bracketCount = scala#CountBrackets(prevline, '(', ')') if bracketCount > 0 || prevline =~ '.*(\s*$' call scala#ConditionalConfirm("5a") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() elseif bracketCount < 0 call scala#ConditionalConfirm("6a") " if the closing brace actually completes the braces entirely, then we @@ -497,7 +497,7 @@ function! GetScalaIndent() else " This is the only part that's different from from the '{', '}' one below " Yup... some refactoring is necessary at some point. - let ind = ind + (bracketCount * &shiftwidth) + let ind = ind + (bracketCount * shiftwidth()) let lineCompletedBrackets = 1 endif endif @@ -506,10 +506,10 @@ function! GetScalaIndent() if curline =~ '^\s*}\?\s*\\%(\s\+\\s*(.*)\)\?\s*{\?\s*$' && \ ! scala#LineIsCompleteIf(prevline) && \ prevline !~ '^.*}\s*$' - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif - " Subtract a 'shiftwidth' on '}' or html + " Subtract a shiftwidth()' on '}' or html let curCurlyCount = scala#CountCurlies(curline) if curCurlyCount < 0 call scala#ConditionalConfirm("14a") @@ -517,7 +517,7 @@ function! GetScalaIndent() return indent(matchline) elseif curline =~ '^\s*]*>' call scala#ConditionalConfirm("14c") - return ind - &shiftwidth + return ind - shiftwidth() endif let prevParenCount = scala#CountParens(prevline) @@ -529,7 +529,7 @@ function! GetScalaIndent() let prevCurlyCount = scala#CountCurlies(prevline) if prevCurlyCount == 0 && prevline =~ '^.*\%(=>\|⇒\)\s*$' && prevline !~ '^\s*this\s*:.*\%(=>\|⇒\)\s*$' && curline !~ '^\s*\' call scala#ConditionalConfirm("16") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() endif if ind == originalIndentValue && curline =~ '^\s*\' @@ -555,7 +555,7 @@ function! GetScalaIndent() if scala#LineIsAClosingXML(prevline) if scala#LineCompletesXML(prevlnum, prevline) call scala#ConditionalConfirm("20a") - return ind - &shiftwidth + return ind - shiftwidth() else call scala#ConditionalConfirm("20b") return ind @@ -566,7 +566,7 @@ function! GetScalaIndent() "let indentMultiplier = scala#LineCompletesDefValr(prevlnum, prevline) "if indentMultiplier != 0 " call scala#ConditionalConfirm("19a") - " let ind = ind - (indentMultiplier * &shiftwidth) + " let ind = ind - (indentMultiplier * shiftwidth()) let defValrLine = scala#Test(prevlnum, prevline, '{', '}') if defValrLine != -1 call scala#ConditionalConfirm("21a") @@ -575,10 +575,10 @@ function! GetScalaIndent() call scala#ConditionalConfirm("21b") if scala#GetLine(prevnonblank(prevlnum - 1)) =~ '^.*\\s*\%(//.*\)\?$' call scala#ConditionalConfirm("21c") - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() elseif scala#LineCompletesIfElse(prevlnum, prevline) call scala#ConditionalConfirm("21d") - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() elseif scala#CountParens(curline) < 0 && curline =~ '^\s*)' && scala#GetLine(scala#GetLineThatMatchesBracket('(', ')')) =~ '.*(\s*$' " Handles situations that look like this: " @@ -592,7 +592,7 @@ function! GetScalaIndent() " 10 " ).somethingHere() call scala#ConditionalConfirm("21e") - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif endif endif diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim index a92f57d67d..e9d61e4366 100644 --- a/runtime/indent/tcl.vim +++ b/runtime/indent/tcl.vim @@ -56,7 +56,7 @@ function GetTclIndent() if line =~ '^\s*\*' return cindent(v:lnum) elseif line =~ '^\s*}' - return indent(v:lnum) - &sw + return indent(v:lnum) - shiftwidth() endif let pnum = s:prevnonblanknoncomment(v:lnum - 1) @@ -64,11 +64,11 @@ function GetTclIndent() return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw + let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() let pline = getline(pnum) if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw + let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() endif return ind diff --git a/runtime/indent/tcsh.vim b/runtime/indent/tcsh.vim index 59a9d56f44..ed08e6c6e2 100644 --- a/runtime/indent/tcsh.vim +++ b/runtime/indent/tcsh.vim @@ -32,17 +32,17 @@ function TcshGetIndent() let ind = indent(lnum) let line = getline(lnum) if line =~ '\v^\s*%(while|foreach)>|^\s*%(case\s.*:|default:|else)\s*$|%(' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Subtract indent if current line has on end, endif, case commands let line = getline(v:lnum) if line =~ '\v^\s*%(else|end|endif)\s*$' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/treetop.vim b/runtime/indent/treetop.vim index 01716e7190..2c6eecf5c4 100644 --- a/runtime/indent/treetop.vim +++ b/runtime/indent/treetop.vim @@ -26,12 +26,12 @@ function GetTreetopIndent() let line = getline(pnum) if line =~ '^\s*\%(grammar\|module\|rule\)\>' - let ind += &sw + let ind += shiftwidth() endif let line = getline(v:lnum) if line =~ '^\s*end\>' - let ind -= &sw + let ind -= shiftwidth() end retur ind diff --git a/runtime/indent/xf86conf.vim b/runtime/indent/xf86conf.vim index 7c3ea15d98..5a8bc0fec1 100644 --- a/runtime/indent/xf86conf.vim +++ b/runtime/indent/xf86conf.vim @@ -26,11 +26,11 @@ function GetXF86ConfIndent() let ind = indent(lnum) if getline(lnum) =~? '^\s*\(Sub\)\=Section\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*End\(Sub\)\=Section\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/xinetd.vim b/runtime/indent/xinetd.vim index 5a32a74d12..977ee3d33b 100644 --- a/runtime/indent/xinetd.vim +++ b/runtime/indent/xinetd.vim @@ -47,8 +47,8 @@ function GetXinetdIndent() return 0 endif - return indent(pnum) + s:count_braces(pnum, 1) * &sw - \ - s:count_braces(v:lnum, 0) * &sw + return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() + \ - s:count_braces(v:lnum, 0) * shiftwidth() endfunction let &cpo = s:keepcpo diff --git a/runtime/syntax/erlang.vim b/runtime/syntax/erlang.vim index 11b763409b..870fcca106 100644 --- a/runtime/syntax/erlang.vim +++ b/runtime/syntax/erlang.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: Erlang (http://www.erlang.org) " Maintainer: Csaba Hoch -" Last Update: 2013-Jul-25 +" Contributor: Adam Rutkowski +" Last Update: 2017-Mar-05 " License: Vim license -" URL: https://github.com/hcs42/vim-erlang +" URL: https://github.com/vim-erlang/vim-erlang-runtime " Acknowledgements: This script was originally created by Kresimir Marzic [1]. " The script was then revamped by Csaba Hoch [2]. During the revamp, the new @@ -46,7 +47,6 @@ syn match erlangComment '%.*$' contains=erlangCommentAnnotation,erlang syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|private\|equiv\|spec\|throws\)' contained syn match erlangCommentAnnotation /`[^']*'/ contained syn keyword erlangTodo TODO FIXME XXX contained -syn match erlangShebang '^#!.*' " Numbers (minimum base is 2, maximum is 36.) syn match erlangNumberInteger '\<\d\+\>' @@ -56,12 +56,12 @@ syn match erlangNumberFloat '\<\d\+\.\d\+\%([eE][+-]\=\d\+\)\=\>' " Strings, atoms, characters syn region erlangString start=/"/ end=/"/ contains=erlangStringModifier syn region erlangQuotedAtom start=/'/ end=/'/ contains=erlangQuotedAtomModifier -syn match erlangStringModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained -syn match erlangQuotedAtomModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained +syn match erlangStringModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\|\~\%([ni~]\|\%(-\=\d\+\|\*\)\=\.\=\%(\*\|\d\+\)\=\%(\..\)\=[tl]*[cfegswpWPBX#bx+]\)' contained +syn match erlangQuotedAtomModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained syn match erlangModifier '\$\%([^\\]\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\)' " Operators, separators -syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' +syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|=>\|:=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' syn keyword erlangOperator div rem or xor bor bxor bsl bsr and band not bnot andalso orelse syn match erlangBracket '{\|}\|\[\|]\||\|||' syn match erlangPipe '|' @@ -72,14 +72,19 @@ syn match erlangAtom '\<\l[[:alnum:]_@]*' contains=erlangBoolean syn keyword erlangBoolean true false contained syn match erlangLocalFuncCall '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangBIF syn match erlangLocalFuncRef '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' -syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment -syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment +syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment,erlangVariable +syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment,erlangVariable -" Variables, macros, records +" Variables, macros, records, maps syn match erlangVariable '\<[A-Z_][[:alnum:]_@]*' syn match erlangMacro '??\=[[:alnum:]_@]\+' syn match erlangMacro '\%(-define(\)\@<=[[:alnum:]_@]\+' +syn match erlangMap '#' syn match erlangRecord '#\s*\l[[:alnum:]_@]*' +syn region erlangQuotedRecord start=/#\s*'/ end=/'/ contains=erlangQuotedAtomModifier + +" Shebang (this line has to be after the ErlangMap) +syn match erlangShebang '^#!.*' " Bitstrings syn match erlangBitType '\%(\/\%(\s\|\n\|%.*\n\)*\)\@<=\%(integer\|float\|binary\|bytes\|bitstring\|bits\|binary\|utf8\|utf16\|utf32\|signed\|unsigned\|big\|little\|native\|unit\)\%(\%(\s\|\n\|%.*\n\)*-\%(\s\|\n\|%.*\n\)*\%(integer\|float\|binary\|bytes\|bitstring\|bits\|binary\|utf8\|utf16\|utf32\|signed\|unsigned\|big\|little\|native\|unit\)\)*' contains=erlangComment @@ -94,7 +99,7 @@ syn match erlangPreCondit '^\s*-\%(\s\|\n\|%.*\n\)*\%(ifdef\|ifndef\|else\|endif syn match erlangType '^\s*-\%(\s\|\n\|%.*\n\)*\%(spec\|type\|opaque\|callback\)\>' contains=erlangComment " Keywords -syn keyword erlangKeyword after begin case catch cond end fun if let of query +syn keyword erlangKeyword after begin case catch cond end fun if let of syn keyword erlangKeyword receive when try " Build-in-functions (BIFs) @@ -142,7 +147,6 @@ let b:erlang_syntax_synced = 1 let s:old_style = (exists("g:erlang_old_style_highlight") && \g:erlang_old_style_highlight == 1) -" Only when an item doesn't have highlighting yet " Comments hi def link erlangComment Comment @@ -188,6 +192,8 @@ hi def link erlangGlobalFuncRef Function hi def link erlangVariable Normal hi def link erlangMacro Normal hi def link erlangRecord Normal +hi def link erlangQuotedRecord Normal +hi def link erlangMap Normal else hi def link erlangAtom String hi def link erlangLocalFuncCall Normal @@ -197,6 +203,8 @@ hi def link erlangGlobalFuncRef Normal hi def link erlangVariable Identifier hi def link erlangMacro Macro hi def link erlangRecord Structure +hi def link erlangQuotedRecord Structure +hi def link erlangMap Structure endif " Bitstrings diff --git a/runtime/syntax/scala.vim b/runtime/syntax/scala.vim index 7779c43996..c5a175fd77 100644 --- a/runtime/syntax/scala.vim +++ b/runtime/syntax/scala.vim @@ -71,6 +71,8 @@ hi link scalaUnicodeChar Special syn match scalaOperator "||" syn match scalaOperator "&&" +syn match scalaOperator "|" +syn match scalaOperator "&" hi link scalaOperator Special syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition,scalaVariableDeclarationList @@ -142,7 +144,7 @@ hi link scalaString String hi link scalaStringEmbeddedQuote String syn region scalaIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"/ skip=/\\"/ end=/"/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar -syn region scalaTripleIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"""/ end=/"""\%([^"]\|$\)/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar +syn region scalaTripleIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"""/ end=/"""\ze\%([^"]\|$\)/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar hi link scalaIString String hi link scalaTripleIString String diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim index 4e87de8417..1ba5f67736 100644 --- a/runtime/syntax/tmux.vim +++ b/runtime/syntax/tmux.vim @@ -4,18 +4,16 @@ " Maintainer: Eric Pruitt " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish -else - let b:current_syntax = "tmux" endif -" this file uses line continuations -let s:cpo_sav = &cpo +" Explicitly change compatiblity options to Vim's defaults because this file +" uses line continuations. +let s:original_cpo = &cpo set cpo&vim +let b:current_syntax = "tmux" setlocal iskeyword+=- syntax case match @@ -62,7 +60,6 @@ for s:i in range(0, 255) exec "syn match tmuxColour" . s:i . " /\\/ display" \ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg endfor -unlet s:bg s:i syn keyword tmuxOptions \ buffer-limit command-alias default-terminal escape-time exit-unattached @@ -123,5 +120,5 @@ syn keyword tmuxCommands \ swapp swap-window swapw switch-client switchc unbind-key unbind wait-for \ wait -let &cpo = s:cpo_sav -unlet! s:cpo_sav +let &cpo = s:original_cpo +unlet! s:original_cpo s:bg s:i